blob: 20ab31c9954b78ccc2cba2ce4e0a97f03c0a18ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
---
- name: "vmid {{ clone_result.vmid }}: set up static ip address"
win_shell: |
Start-Transcript -Path C:\set_domain_network_log.txt -Append
Get-NetIpAddress -InterfaceAlias 'Ethernet' | Remove-NetIPAddress -Confirm:$false
New-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress "{{ ip }}" -PrefixLength 24 -DefaultGateway "{{ gateway }}"
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses "{{ dns }}"
Get-NetConnectionProfile -InterfaceAlias 'Ethernet' | Set-NetConnectionProfile -NetworkCategory Private
Stop-Transcript
async: 15
poll: 0
delegate_to: "{{ vm_ip }}"
- name: "vmid {{ clone_result.vmid }}: update ip to {{ ip }}"
set_fact:
ansible_host: "{{ ip }}"
- name: "vmid {{ clone_result.vmid }}: pause execution for 1 minute to allow ip change and reconnect"
pause:
minutes: 1
|