ansible/test/integration/targets/vmware_host_datastore/tasks/main.yml
Gonéri Le Bouder 0aa59ce9ab vmware/test: use better name for datastores
In the VMware tests, we call the datastores `ds1` and `ds2`. The first
one is read-only, the second is read-write and can be used to deploy
VMs. The naming convention was not clear enough and source of a lot
confusion and mistake.

We now have two better names:

- ro_datastore, which is ... read-only
- rw_datastore, the one that we can use to deploy new VM.
2019-11-14 16:55:05 -05:00

84 lines
3.3 KiB
YAML

- when: vcsim is not defined
block:
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
- name: Mount NFS (ro_datastore) datastores without esxi_hostname
vmware_host_datastore:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datastore_name: '{{ ro_datastore }}'
datastore_type: '{{ infra.datastores[ro_datastore].type }}'
nfs_server: '{{ infra.datastores[ro_datastore].server }}'
nfs_path: '{{ infra.datastores[ro_datastore].path }}'
nfs_ro: '{{ infra.datastores[ro_datastore].ro }}'
state: present
validate_certs: no
ignore_errors: true
register: mount_vmware_host_datastore
- debug: var=mount_vmware_host_datastore
- assert:
that:
- mount_vmware_host_datastore is failed
- mount_vmware_host_datastore.msg == "esxi_hostname is mandatory with a vcenter"
- name: Mount NFS (ro_datastore) datastores with non existing host in esxi_hostname
vmware_host_datastore:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: 'nohost'
datastore_name: '{{ ro_datastore }}'
datastore_type: '{{ infra.datastores[ro_datastore].type }}'
nfs_server: '{{ infra.datastores[ro_datastore].server }}'
nfs_path: '{{ infra.datastores[ro_datastore].path }}'
nfs_ro: '{{ infra.datastores[ro_datastore].ro }}'
state: present
validate_certs: no
ignore_errors: true
register: mount_vmware_host_datastore
- debug: var=mount_vmware_host_datastore
- assert:
that:
- mount_vmware_host_datastore is failed
- mount_vmware_host_datastore.msg == "Failed to find ESXi hostname nohost"
- name: Mount NFS (ro_datastore) datastores on esxi1 using esxi_hostname
vmware_host_datastore:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: '{{ esxi1 }}'
datastore_name: '{{ ro_datastore }}'
datastore_type: '{{ infra.datastores[ro_datastore].type }}'
nfs_server: '{{ infra.datastores[ro_datastore].server }}'
nfs_path: '{{ infra.datastores[ro_datastore].path }}'
nfs_ro: '{{ infra.datastores[ro_datastore].ro }}'
state: present
validate_certs: no
register: mount_vmware_host_datastore
- debug: var=mount_vmware_host_datastore
- assert:
that:
- mount_vmware_host_datastore is changed
- name: Mount NFS (ro_datastore) datastores to ESXi directly
vmware_host_datastore:
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
datastore_name: '{{ ro_datastore }}'
datastore_type: '{{ infra.datastores[ro_datastore].type }}'
nfs_server: '{{ infra.datastores[ro_datastore].server }}'
nfs_path: '{{ infra.datastores[ro_datastore].path }}'
nfs_ro: '{{ infra.datastores[ro_datastore].ro }}'
state: present
validate_certs: no
register: mount_vmware_host_datastore
- debug: var=mount_vmware_host_datastore
- assert:
that:
- not (mount_vmware_host_datastore is changed)