#113 solution - Windows AD domain reboots (#114)

This commit is contained in:
MKletz
2023-11-13 10:12:18 -06:00
committed by GitHub
parent dd1de852b6
commit d5093fa544

View File

@@ -13,30 +13,23 @@
ansible.windows.win_domain: ansible.windows.win_domain:
dns_domain_name: ansible.local dns_domain_name: ansible.local
safe_mode_password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}" safe_mode_password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
register: new_forest notify:
- Reboot host
- Wait for AD services
- Reboot again
- Wait for AD services again
- name: Reboot the target host - name: Flush handlers
ansible.windows.win_reboot: meta: flush_handlers
reboot_timeout: 3600
when: new_forest.reboot_required
- name: Wait up to 10min for AD web services to start
community.windows.win_wait_for_process:
process_name_exact: Microsoft.ActiveDirectory.WebServices
pre_wait_delay: 60
state: present
timeout: 600
sleep: 10
remote_user: Administrator
- name: Create some groups - name: Create some groups
community.windows.win_domain_group: community.windows.win_domain_group:
name: "{{ item.name }}" name: "{{ item.name }}"
scope: global scope: global
loop: loop:
- {name: "GroupA"} - { name: "GroupA" }
- {name: "GroupB"} - { name: "GroupB" }
- {name: "GroupC"} - { name: "GroupC" }
retries: 5 retries: 5
delay: 10 delay: 10
@@ -47,8 +40,33 @@
password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}" password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
update_password: on_create update_password: on_create
loop: loop:
- {name: "UserA", groups: "GroupA"} - { name: "UserA", groups: "GroupA" }
- {name: "UserB", groups: "GroupB"} - { name: "UserB", groups: "GroupB" }
- {name: "UserC", groups: "GroupC"} - { name: "UserC", groups: "GroupC" }
retries: 5 retries: 5
delay: 10 delay: 10
handlers:
- name: Reboot host
ansible.windows.win_reboot:
reboot_timeout: 3600
- name: Wait for AD services
community.windows.win_wait_for_process:
process_name_exact: Microsoft.ActiveDirectory.WebServices
pre_wait_delay: 60
state: present
timeout: 600
sleep: 10
- name: Reboot again
ansible.windows.win_reboot:
reboot_timeout: 3600
- name: Wait for AD services again
community.windows.win_wait_for_process:
process_name_exact: Microsoft.ActiveDirectory.WebServices
pre_wait_delay: 60
state: present
timeout: 600
sleep: 10