ansible/test/integration/targets/setup_win_device/tasks/main.yml

23 lines
815 B
YAML
Raw Normal View History

# Creates a network adapter device for testing purposes and registers the following vars
# network_device_name: The name of the network device
# network_adapter_name: The name of the network adapter
---
- name: create dummy network adapter device
win_device:
path: '%WinDir%\Inf\netloop.inf'
hardware_id: '*msloop'
state: present
register: network_device_name_raw
notify: remove dummy network adapter device
- set_fact:
network_device_name: '{{ network_device_name_raw.name }}'
- name: get name of the dummy network adapter
win_shell: (Get-CimInstance -Class Win32_NetworkAdapter -Filter "Name='{{ network_device_name }}'").NetConnectionID
changed_when: False
register: network_adapter_name_raw
- set_fact:
network_adapter_name: '{{ network_adapter_name_raw.stdout | trim }}'