72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
---
|
|
- name: Set HostOnly DNS Address
|
|
win_shell: "Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.38.102,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
|
|
args:
|
|
creates: c:\vagrant\Vagrantfile
|
|
|
|
- name: Making Windows10 Great Again
|
|
win_shell: .\\MakeWindows10GreatAgain.ps1
|
|
args:
|
|
chdir: 'c:\vagrant\scripts'
|
|
register: win10_great
|
|
changed_when: "' was already installed. Moving On.' not in win10_great.stdout"
|
|
|
|
- name: Join the Domain
|
|
win_shell: .\\provision.ps1
|
|
args:
|
|
chdir: 'c:\vagrant\scripts'
|
|
register: win10_join_domain
|
|
changed_when: "'HasSucceeded : True' in win10_join_domain.stdout"
|
|
failed_when: '"failed to join domain" in win10_join_domain.stderr'
|
|
|
|
- name: Update group policy
|
|
win_shell: "gpupdate /force"
|
|
when: win10_join_domain.changed
|
|
|
|
- name: Reboot Server
|
|
win_reboot:
|
|
msg: "Joined the domain. Rebooting..."
|
|
pre_reboot_delay: 15
|
|
reboot_timeout: 600
|
|
post_reboot_delay: 60
|
|
when: win10_join_domain.changed
|
|
|
|
- name: Clear Event Logs
|
|
win_shell: "wevtutil el | Select-String -notmatch \"Microsoft-Windows-LiveId\" | Foreach-Object {wevtutil cl \"$_\"}"
|
|
|
|
- name: Install Classic Shell with Chocolatey
|
|
win_chocolatey:
|
|
name:
|
|
- classic-shell
|
|
state: present
|
|
install_args: "ADDLOCAL=ClassicStartMenu"
|
|
|
|
- name: Import ClassicShell config
|
|
win_shell: |
|
|
"C:\Program Files\Classic Shell\ClassicStartMenu.exe -xml c:\vagrant\resources\windows\MenuSettings.xml"
|
|
regedit /s c:\vagrant\resources\windows\MenuStyle_Default_Win7.reg
|
|
|
|
|
|
|
|
|
|
|