68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
---
|
||
|
||
- name: Hostname -> DC
|
||
win_hostname:
|
||
name: dc
|
||
register: res
|
||
|
||
- name: Reboot
|
||
win_reboot:
|
||
when: res.reboot_required
|
||
|
||
- name: Set HostOnly IP Address
|
||
win_shell: "New-NetIPAddress –InterfaceAlias Ethernet2 –AddressFamily IPv4 -IPAddress 192.168.38.102 –PrefixLength 24 -DefaultGateway 192.168.38.1"
|
||
|
||
- name: Set DNS Address
|
||
win_shell: "Set-DnsClientServerAddress -InterfaceAlias Ethernet2 -ServerAddresses 127.0.0.1,8.8.8.8"
|
||
|
||
- name: Install git
|
||
win_chocolatey:
|
||
name: git
|
||
state: present
|
||
|
||
- name: Check if existing DetectionLab directory
|
||
win_stat:
|
||
path: 'c:\DetectionLab'
|
||
register: dir
|
||
|
||
- name: Git clone Detectionlab
|
||
win_shell: git clone https://github.com/clong/DetectionLab.git
|
||
args:
|
||
chdir: 'c:\'
|
||
when: not dir.stat.exists
|
||
|
||
- name: Copy scripts to c:\vagrant
|
||
win_shell: Copy-Item -Recurse c:\DetectionLab\Vagrant c:\vagrant
|
||
|
||
- name: Create the Domain
|
||
win_shell: .\\provision.ps1
|
||
args:
|
||
chdir: 'c:\vagrant\scripts'
|
||
|
||
- name: reboot server
|
||
win_reboot:
|
||
msg: "Installing AD. Rebooting..."
|
||
pre_reboot_delay: 15
|
||
reboot_timeout: 600
|
||
post_reboot_delay: 60
|
||
|
||
- name: Configure DC Host
|
||
win_shell: ".\\{{ item }}"
|
||
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"
|
||
|
||
- name: Configure DC with raw Commands
|
||
win_shell: "{{ item }}"
|
||
with_items:
|
||
- "wevtutil el | Select-String -notmatch \"Microsoft-Windows-LiveId\" | Foreach-Object {wevtutil cl \"$_\"}"
|
||
- "Set-SmbServerConfiguration -AuditSmb1Access $true -Force"
|
||
|
||
|