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

@@ -4,6 +4,10 @@
# Testcase: Add Host
- when: vcsim is not defined
block:
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
- name: Add first ESXi Host to vCenter
vmware_host:
@@ -13,8 +17,8 @@
datacenter_name: '{{ dc1 }}'
cluster_name: '{{ ccr1 }}'
esxi_hostname: '{{ esxi1 }}'
esxi_username: '{{ hostvars[esxi1].ansible_user }}'
esxi_password: '{{ hostvars[esxi1].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
state: present
validate_certs: no
register: readd_host_result
@@ -27,8 +31,8 @@
datacenter_name: '{{ dc1 }}'
cluster_name: '{{ ccr1 }}'
esxi_hostname: '{{ esxi1 }}'
esxi_username: '{{ hostvars[esxi1].ansible_user }}'
esxi_password: '{{ hostvars[esxi1].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
state: present
validate_certs: no
register: readd_host_result
@@ -45,11 +49,10 @@
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
datacenter_name: "{{ dc1 }}"
cluster_name: "{{ ccr1 }}"
fetch_ssl_thumbprint: False
state: add_or_reconnect
register: add_or_reconnect_host_result
- name: ensure host system is present
@@ -119,8 +122,8 @@
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
datacenter_name: "{{ dc1 }}"
folder_name: "/{{ dc1 }}/host/Staging"
state: present
@@ -139,8 +142,8 @@
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
datacenter_name: "{{ dc1 }}"
folder_name: "/{{ dc1 }}/host/Staging"
state: present
@@ -158,8 +161,8 @@
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}'
esxi_username: '{{ esxi_user }}'
esxi_password: '{{ esxi_password }}'
datacenter_name: "{{ dc1 }}"
cluster_name: "{{ ccr1 }}"
state: reconnect