vmware_vswitch/test: clean up vmswitch_0002

Ensure `vmswitch_0002` get removed from ESXi2 at the end of the test.
This commit is contained in:
Gonéri Le Bouder 2020-01-28 11:59:27 -05:00
parent e64b279ea1
commit 6e2fff1acc
2 changed files with 19 additions and 10 deletions

View file

@ -11,16 +11,7 @@
# TODO: akasurde: VCSIM does not suport network manager system
- name: Ensure the vswitch is not already here
vmware_vswitch:
validate_certs: no
hostname: '{{ item.host }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch: '{{ item.switch }}'
state: absent
with_items:
- {host: "{{ esxi1 }}", switch: "vmswitch_0001"}
- {host: "{{ esxi2 }}", switch: "vmswitch_0002"}
include_tasks: teardown.yml
- name: Add a nic to a switch
vmware_vswitch:
@ -91,3 +82,5 @@
- assert:
that:
- add_vswitch_with_host_system is changed
always:
- include_tasks: teardown.yml

View file

@ -0,0 +1,16 @@
- name: Remove the vSwitches (ESXi1)
vmware_vswitch:
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch_name: vmswitch_0001
state: absent
- name: Remove the vSwitches (ESXi2)
vmware_vswitch:
hostname: '{{ esxi2 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch_name: vmswitch_0002
state: absent
when: esxi2 is defined