Set up network interfaces and SSH for Windows hosts. We can’t gather facts before we know which remote shell to use, so first run a win_ping to determine if a given host is running Windows.
12 lines
415 B
YAML
12 lines
415 B
YAML
- name: Rename interface
|
|
win_shell: >
|
|
Get-NetAdapter
|
|
| Where-Object -Property MacAddress -eq "{{ interface.mac_address | replace(':', '-') }}"
|
|
| Rename-NetAdapter -NewName "{{ interface.name }}"
|
|
changed_when: false # not really but we don’t care
|
|
|
|
- include_tasks: interface_address.yml
|
|
loop: "{{ interface.ip_addresses }}"
|
|
loop_control:
|
|
label: "{{ interface.name }}"
|
|
loop_var: address
|