Ansible/playbook/roles/windows_ip_set/tasks/main.yaml

19 lines
1.1 KiB
YAML

- name: Set up static IP address {{privatip}}.8
win_shell: "Get-NetIpAddress -InterfaceAlias 'Ethernet' | New-NetIpAddress -IpAddress {{privatip}}.8 -PrefixLength 24 -DefaultGateway {{privatip}}.1"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0
when: inventory_hostname == "AD01"
- name: Set up static IP address {{privatip}}.7
win_shell: "Get-NetIpAddress -InterfaceAlias 'Ethernet' | New-NetIpAddress -IpAddress {{privatip}}.7 -PrefixLength 24 -DefaultGateway {{privatip}}.1"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0
when: inventory_hostname == "RDS01"
- name: Set DNS Server
win_shell: "Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses ('{{privatip}}.8','1.1.1.1')"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0
- name: Set {{privatip}} to Privat
win_shell: "Set-NetConnectionProfile -InterfaceAlias 'Ethernet' -NetworkCategory Private"