feat ✨: Stop Samba services before provisioning
Added a new task to stop relevant Samba services before provisioning, ensuring a clean environment for the AD DC setup. This change improves the overall stability and reliability of the provisioning process.
This commit is contained in:
@@ -20,6 +20,17 @@
|
||||
# enabled: no
|
||||
# ignore_errors: true
|
||||
|
||||
- name: Stop Samba services before provisioning
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
ignore_errors: true
|
||||
loop:
|
||||
- samba-ad-dc
|
||||
- smbd
|
||||
- nmbd
|
||||
- winbind
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
path: /var/lib/samba/private/adsync.conf
|
||||
register: samba_provisioned
|
||||
|
||||
- name: Remove smb.conf if server role conflicts
|
||||
ansible.builtin.shell: |
|
||||
if grep -q "server role = standalone server" /etc/samba/smb.conf 2>/dev/null; then
|
||||
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak.$(date +%s)
|
||||
fi
|
||||
args:
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
when: not samba_provisioned.stat.exists
|
||||
|
||||
- name: Provision the Samba AD DC
|
||||
ansible.builtin.command: >
|
||||
samba-tool domain provision
|
||||
|
||||
Reference in New Issue
Block a user