Adding final ESXI deployment code
This commit is contained in:
61
ESXi/ansible/roles/win10/tasks/main.yml
Normal file
61
ESXi/ansible/roles/win10/tasks/main.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
|
||||
- name: Hostname -> WIN10
|
||||
win_hostname:
|
||||
name: win10
|
||||
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.104 –PrefixLength 24 -DefaultGateway 192.168.38.1"
|
||||
|
||||
- name: Set HostOnly DNS Address
|
||||
win_shell: "Set-DnsClientServerAddress -InterfaceAlias Ethernet2 -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
|
||||
|
||||
- name: Making Windows10 Great Again
|
||||
win_shell: .\\MakeWindows10GreatAgain.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
|
||||
- name: Join the Domain
|
||||
win_shell: .\\provision.ps1
|
||||
args:
|
||||
chdir: 'c:\vagrant\scripts'
|
||||
|
||||
- name: Update group policy
|
||||
win_shell: "gpupdate /force"
|
||||
|
||||
- name: Reboot Server
|
||||
win_reboot:
|
||||
msg: "Joined the domain. Rebooting..."
|
||||
pre_reboot_delay: 15
|
||||
reboot_timeout: 600
|
||||
post_reboot_delay: 60
|
||||
|
||||
- name: Clear Event Logs
|
||||
win_shell: "wevtutil el | Select-String -notmatch \"Microsoft-Windows-LiveId\" | Foreach-Object {wevtutil cl \"$_\"}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user