ansible/test/integration/targets/win_netbios/tasks/main.yml
Tom Moore a589cac18a Windows: new win_netbios module (#58331)
* Initial commit win_netbios module

* Ansibot sanity improvements.

* Corrected file permissions.

* Windows: module description update

* Adding integration tests

* Added missing alias file

* Improvements made to tests and WMI efficiency.

* Correction from sanity check failures

* Shippable corrections

* Moved reboot flag.

* Slight tweak to return value conditoin
2019-07-29 07:56:53 +10:00

54 lines
No EOL
1.7 KiB
YAML

# Test code for win_netbios module
# Copyright: (c) 2019, Thomas Moore <hi@tmmr.uk>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: ensure netbios is set to default to start with
win_netbios:
state: default
- name: create dummy network adapter device
win_device:
path: '%WinDir%\Inf\netloop.inf'
hardware_id: '*msloop'
state: present
register: test_device_name
- set_fact:
test_device_name: '{{ test_device_name.name }}'
- block:
- name: get name of the dummy network adapter
win_shell: (Get-CimInstance -Class Win32_NetworkAdapter -Filter "Name='{{ test_device_name }}'").NetConnectionID
changed_when: False
register: test_adapter
- set_fact:
test_adapter: '{{ test_adapter.stdout | trim }}'
- name: run tests
include_tasks: tests.yml
always:
- name: remove dummy network adapter device
win_device:
name: '{{ test_device_name }}'
state: absent
- name: set netbios back to default after tests
win_netbios:
state: default