vmware: test-refactoring

- In order to keep the integration with `ansible-test`, we prefer to avoid any
  interaction with the Ansible inventory file.
- split up the prepare_vmware_tests/defaults/main.yml in two
  configuration files: one for vcsim and one for a real environment
- remove all the access to hostvars
- directly interact with the ESXi to mount/umount the datastore
  https://github.com/ansible/ansible/pull/56516
- record the virtual machine folder in the environment configuration
- vmware_guest_move: Use https://github.com/ansible/ansible/pull/55237
This commit is contained in:
Gonéri Le Bouder
2019-05-16 09:36:48 -04:00
parent 4adb7cfb5f
commit 6bb21c3db0
52 changed files with 612 additions and 532 deletions

View File

@@ -14,9 +14,9 @@
- name: Add a nic to a switch
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
nics: vnic_1
@@ -28,9 +28,9 @@
- name: Add a nic to a switch again
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
nics: vnic_1
@@ -42,9 +42,9 @@
- name: Remove a switch (check-mode)
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
state: absent
@@ -58,9 +58,9 @@
# FIXME: Removing a switch fails
- name: Remove a switch
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
state: absent
@@ -71,9 +71,9 @@
- name: Remove a switch again (check-mode)
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
state: absent
@@ -87,9 +87,9 @@
# FIXME: Removing a switch fails
- name: Remove a switch again
vmware_vswitch:
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
validate_certs: no
switch: vmswitch_0001
state: absent
@@ -101,9 +101,9 @@
- name: Add vswitch to a specific host system
vmware_vswitch:
validate_certs: False
hostname: '{{ hostvars[esxi1].ansible_host }}'
username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}'
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
switch: vmswitch_0002
nics: vnic_1
esxi_hostname: guest1