feat ✨: Check domain before provisioning Samba AD DC
Added a check to ensure the domain is not already provisioned before running the samba-tool domain provision command. This prevents duplicate provisions and ensures consistency in the domain setup.
This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
- name: check if domain already provisioned
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: /var/lib/samba/private/adsync.conf
|
||||||
|
register: samba_provisioned
|
||||||
|
|
||||||
- name: Provision the Samba AD DC
|
- name: Provision the Samba AD DC
|
||||||
ansible.builtin.command: >
|
ansible.builtin.command: >
|
||||||
samba-tool domain provision
|
samba-tool domain provision
|
||||||
@@ -10,6 +15,7 @@
|
|||||||
--adminpass={{ addc_admin_password }}
|
--adminpass={{ addc_admin_password }}
|
||||||
--option="interfaces=lo eth0"
|
--option="interfaces=lo eth0"
|
||||||
--option="bind interfaces only=yes"
|
--option="bind interfaces only=yes"
|
||||||
|
when: not samba_provisioned.stat.exists
|
||||||
register: samba_provision_output
|
register: samba_provision_output
|
||||||
changed_when: samba_provision_output.rc == 0
|
changed_when: samba_provision_output.rc == 0
|
||||||
no_log: true # You may toggle this if password should be hidden
|
no_log: true # You may toggle this if password should be hidden
|
||||||
|
|||||||
Reference in New Issue
Block a user