Break out Ansible tasks
This commit is contained in:
@@ -38,25 +38,106 @@
|
||||
win_shell: .\\provision.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: domain_creation
|
||||
changed_when: "'Status : Success' in domain_creation.stdout"
|
||||
failed_when: "'Exception' in domain_creation.stderr"
|
||||
|
||||
- name: reboot server
|
||||
- name: Reboot Afer Domain Creation
|
||||
win_reboot:
|
||||
msg: "Installing AD. Rebooting..."
|
||||
pre_reboot_delay: 15
|
||||
reboot_timeout: 600
|
||||
post_reboot_delay: 60
|
||||
|
||||
- name: Configure DC Host
|
||||
win_shell: ".\\{{ item }}"
|
||||
- name: Configure OU
|
||||
win_shell: .\\configure-ou.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
with_items:
|
||||
- "configure-ou.ps1"
|
||||
- "configure-wef-gpo.ps1"
|
||||
- "configure-powershelllogging.ps1"
|
||||
- "configure-AuditingPolicyGPOs.ps1"
|
||||
- "configure-disable-windows-defender-gpo.ps1"
|
||||
- "configure-rdp-user-gpo.ps1"
|
||||
register: ou_creation
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in ou_creation.stderr"
|
||||
|
||||
- debug: msg="{{ ou_creation.stdout_lines }}"
|
||||
|
||||
- name: Configure WEF GPO
|
||||
win_shell: .\\configure-wef-gpo.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: wef_gpo
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in wef_gpo.stderr"
|
||||
|
||||
- debug: msg="{{ wef_gpo.stdout_lines }}"
|
||||
|
||||
- name: Configure Powershell Logging GPO
|
||||
win_shell: .\\configure-powershelllogging.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: powershell_gpo
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in powershell_gpo.stderr"
|
||||
|
||||
- debug: msg="{{ powershell_gpo.stdout_lines }}"
|
||||
|
||||
- name: Configure Auditing Policy GPO
|
||||
win_shell: .\\configure-AuditingPolicyGPOs.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: audit_policy
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in audit_policy.stderr"
|
||||
|
||||
- debug: msg="{{ audit_policy.stdout_lines }}"
|
||||
|
||||
- name: Disable Windows Defender GPO
|
||||
win_shell: .\\configure-disable-windows-defender-gpo.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: disable_win_def
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in disable_win_def.stderr"
|
||||
|
||||
- debug: msg="{{ disable_win_def.stdout_lines }}"
|
||||
|
||||
- name: Configure RDP Permissions GPO
|
||||
win_shell: .\\configure-rdp-user-gpo.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
register: rdp_gpo
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: runas
|
||||
ansible_become_user: windomain.local\vagrant
|
||||
ansible_become_password: vagrant
|
||||
ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only
|
||||
failed_when: "'Exception' in rdp_gpo.stderr"
|
||||
|
||||
- debug: msg="{{ rdp_gpo.stdout_lines }}"
|
||||
|
||||
- name: Configure DC with raw Commands
|
||||
win_shell: "{{ item }}"
|
||||
|
||||
Reference in New Issue
Block a user