|
|
|
- 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)
|