diff options
Diffstat (limited to 'ansible/roles/dc01')
-rw-r--r-- | ansible/roles/dc01/tasks/cleanup.yaml | 3 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/init.yaml | 3 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/install_software.yaml | 3 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/main.yaml | 41 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/populate_ad.yaml | 7 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/reboot.yaml | 3 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/set_hostname.yaml | 2 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/setup_domain.yaml | 6 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/setup_gpo.yaml | 7 | ||||
-rw-r--r-- | ansible/roles/dc01/tasks/wait_for_ready.yaml | 3 |
10 files changed, 78 insertions, 0 deletions
diff --git a/ansible/roles/dc01/tasks/cleanup.yaml b/ansible/roles/dc01/tasks/cleanup.yaml new file mode 100644 index 0000000..e30df58 --- /dev/null +++ b/ansible/roles/dc01/tasks/cleanup.yaml @@ -0,0 +1,3 @@ +- name: "{{ ansible_host }}: execute cleanup.ps1" + ansible.windows.win_powershell: + script: C:\scripts\cleanup.ps1 diff --git a/ansible/roles/dc01/tasks/init.yaml b/ansible/roles/dc01/tasks/init.yaml new file mode 100644 index 0000000..afd2820 --- /dev/null +++ b/ansible/roles/dc01/tasks/init.yaml @@ -0,0 +1,3 @@ +- name: "{{ ansible_host }}: execute init.ps1" + ansible.windows.win_powershell: + script: C:\scripts\init.ps1 diff --git a/ansible/roles/dc01/tasks/install_software.yaml b/ansible/roles/dc01/tasks/install_software.yaml new file mode 100644 index 0000000..4c43d2b --- /dev/null +++ b/ansible/roles/dc01/tasks/install_software.yaml @@ -0,0 +1,3 @@ +- name: "{{ ansible_host }}: execute install-software.ps1" + ansible.windows.win_powershell: + script: C:\scripts\install-software.ps1 diff --git a/ansible/roles/dc01/tasks/main.yaml b/ansible/roles/dc01/tasks/main.yaml new file mode 100644 index 0000000..2ce79c9 --- /dev/null +++ b/ansible/roles/dc01/tasks/main.yaml @@ -0,0 +1,41 @@ +- name: wait for winrm to be available + ansible.builtin.wait_for: + host: "{{ ansible_host }}" + port: "{{ ansible_port }}" + timeout: 300 + delegate_to: localhost + vars: + ansible_connection: local + +- name: execute init.ps1 + import_tasks: init.yaml + +- name: set hostname + import_tasks: set_hostname.yaml + +- name: reboot after hostname change + import_tasks: reboot.yaml + +- name: execute setup-main-domain.ps1 + import_tasks: setup_domain.yaml + +- name: reboot after domain setup + import_tasks: reboot.yaml + +- name: execute dc-wait-for-ready.ps1 + import_tasks: wait_for_ready.yaml + +- name: execute populate-ad.ps1 + import_tasks: populate_ad.yaml + +- name: execute setup-gpo.ps1 as domain admin + import_tasks: setup_gpo.yaml + +- name: reboot after gpo setup + import_tasks: reboot.yaml + +- name: execute install-software.ps1 + import_tasks: install_software.yaml + +- name: execute cleanup.ps1 + import_tasks: cleanup.yaml diff --git a/ansible/roles/dc01/tasks/populate_ad.yaml b/ansible/roles/dc01/tasks/populate_ad.yaml new file mode 100644 index 0000000..1cc0308 --- /dev/null +++ b/ansible/roles/dc01/tasks/populate_ad.yaml @@ -0,0 +1,7 @@ +- name: "{{ ansible_host }}: execute populate-ad.ps1" + ansible.windows.win_powershell: + script: C:\scripts\populate-ad.ps1 + parameters: + DomainName: "{{ domain_name }}" + UserPassword: "{{ default_win_user_password }}" + SvcPassword: "{{ default_win_svc_password }}" diff --git a/ansible/roles/dc01/tasks/reboot.yaml b/ansible/roles/dc01/tasks/reboot.yaml new file mode 100644 index 0000000..6c17c3d --- /dev/null +++ b/ansible/roles/dc01/tasks/reboot.yaml @@ -0,0 +1,3 @@ +- name: "{{ ansible_host }}: reboot" + ansible.windows.win_reboot: + reboot_timeout: 3600 diff --git a/ansible/roles/dc01/tasks/set_hostname.yaml b/ansible/roles/dc01/tasks/set_hostname.yaml new file mode 100644 index 0000000..7cca168 --- /dev/null +++ b/ansible/roles/dc01/tasks/set_hostname.yaml @@ -0,0 +1,2 @@ +- name: "{{ ansible_host }}: set hostname" + ansible.windows.win_shell: Rename-Computer -NewName "{{ hostname }}" -Force diff --git a/ansible/roles/dc01/tasks/setup_domain.yaml b/ansible/roles/dc01/tasks/setup_domain.yaml new file mode 100644 index 0000000..43fcfc4 --- /dev/null +++ b/ansible/roles/dc01/tasks/setup_domain.yaml @@ -0,0 +1,6 @@ +- name: "{{ ansible_host }}: execute setup-main-domain.ps1" + ansible.windows.win_powershell: + script: C:\scripts\setup-main-domain.ps1 + parameters: + DomainName: "{{ domain_name }}" + SafeModePassword: "{{ default_win_safemode_password }}" diff --git a/ansible/roles/dc01/tasks/setup_gpo.yaml b/ansible/roles/dc01/tasks/setup_gpo.yaml new file mode 100644 index 0000000..aa84237 --- /dev/null +++ b/ansible/roles/dc01/tasks/setup_gpo.yaml @@ -0,0 +1,7 @@ +- name: "{{ ansible_host }}: execute setup-gpo.ps1 as domain admin" + ansible.windows.win_command: powershell.exe -ExecutionPolicy Bypass -File C:\scripts\setup-gpo.ps1 -DomainName "{{ domain_name }}" + become: yes + become_method: runas + become_user: "{{ domain_name }}\\Administrator" + vars: + ansible_become_password: "{{ default_win_password }}" diff --git a/ansible/roles/dc01/tasks/wait_for_ready.yaml b/ansible/roles/dc01/tasks/wait_for_ready.yaml new file mode 100644 index 0000000..c43431c --- /dev/null +++ b/ansible/roles/dc01/tasks/wait_for_ready.yaml @@ -0,0 +1,3 @@ +- name: "{{ ansible_host }}: execute dc-wait-for-ready.ps1" + ansible.windows.win_powershell: + script: C:\scripts\dc-wait-for-ready.ps1 |