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

15 lines
847 B
YAML

---
- name: ADD static Ansible-IP Address {{ ansible_host }}
win_shell: "Get-NetIpAddress -InterfaceAlias 'Ethernet 2' | New-NetIpAddress -IpAddress {{ ansible_host }} -PrefixLength 24 -DefaultGateway 110.1.1.250"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0
- name: Set IP Adress to {{ ip }}
win_shell: "Set-NetIpAddress -InterfaceAlias 'Ethernet 2' -IpAddress {{ ip }} -PrefixLength 24"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0
- name: Remove IPAdress 110.1.1.50
win_shell: "Remove-NetIPAddress -IpAddress 110.1.1.50 -Confirm:$false"
async: 100 # Using "fire-and-forget" asynchronous execution for this task, otherwise it will always fail and timeout
poll: 0