diff options
author | heqnx <root@heqnx.com> | 2025-07-11 21:55:20 +0300 |
---|---|---|
committer | heqnx <root@heqnx.com> | 2025-07-11 21:55:20 +0300 |
commit | 6ec2eb61a02f9e55ef5b8d22a5ca61ca53ca05e7 (patch) | |
tree | d975569e35991a02c73706ce81c0fc1f2e92405c /ansible/roles/proxmox_vm/tasks/set_network.yaml | |
parent | 742fa0d51cd384ea3d856438861bb86738fdabb8 (diff) | |
download | ansible-active-directory-range-6ec2eb61a02f9e55ef5b8d22a5ca61ca53ca05e7.tar.gz ansible-active-directory-range-6ec2eb61a02f9e55ef5b8d22a5ca61ca53ca05e7.zip |
added initial setup for domain controller
Diffstat (limited to 'ansible/roles/proxmox_vm/tasks/set_network.yaml')
-rw-r--r-- | ansible/roles/proxmox_vm/tasks/set_network.yaml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ansible/roles/proxmox_vm/tasks/set_network.yaml b/ansible/roles/proxmox_vm/tasks/set_network.yaml new file mode 100644 index 0000000..20ab31c --- /dev/null +++ b/ansible/roles/proxmox_vm/tasks/set_network.yaml @@ -0,0 +1,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 |