2018-03-09 05:44:15 +01:00
|
|
|
# Test code for the vmware_datastore_cluster module.
|
|
|
|
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
2019-04-30 12:22:50 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
2018-03-09 05:44:15 +01:00
|
|
|
|
|
|
|
- name: Add a datastore cluster to datacenter (check-mode)
|
|
|
|
vmware_datastore_cluster: &add_datastore_cluster
|
2019-04-30 12:22:50 +02:00
|
|
|
hostname: '{{ vcenter_hostname }}'
|
|
|
|
username: '{{ vcenter_username }}'
|
|
|
|
password: '{{ vcenter_password }}'
|
2018-03-09 05:44:15 +01:00
|
|
|
validate_certs: no
|
|
|
|
datacenter_name: "{{ dc1 }}"
|
|
|
|
datastore_cluster_name: DSC1
|
|
|
|
state: present
|
|
|
|
check_mode: yes
|
|
|
|
register: add_dsc_check
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-04-30 12:22:50 +02:00
|
|
|
- add_dsc_check.changed
|
2018-03-09 05:44:15 +01:00
|
|
|
|
|
|
|
- name: Add a datastore cluster to datacenter
|
|
|
|
vmware_datastore_cluster: *add_datastore_cluster
|
|
|
|
register: add_dsc
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-04-30 12:22:50 +02:00
|
|
|
- add_dsc.changed
|
2018-03-09 05:44:15 +01:00
|
|
|
|
|
|
|
- name: Add a datastore cluster to datacenter again
|
|
|
|
vmware_datastore_cluster: *add_datastore_cluster
|
|
|
|
register: add_dsc
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-04-30 12:22:50 +02:00
|
|
|
- not add_dsc.changed
|
2018-03-09 05:44:15 +01:00
|
|
|
|
2019-06-08 00:34:20 +02:00
|
|
|
- name: Create a VM folder on given Datacenter
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: '{{ vcenter_hostname }}'
|
|
|
|
username: '{{ vcenter_username }}'
|
|
|
|
password: '{{ vcenter_password }}'
|
|
|
|
datacenter: '{{ dc1 }}'
|
|
|
|
folder_name: 'my_datastore_folder'
|
|
|
|
folder_type: datastore
|
|
|
|
state: present
|
|
|
|
validate_certs: no
|
|
|
|
register: my_datastore_folder
|
|
|
|
|
2019-05-21 12:25:43 +02:00
|
|
|
- name: Add a datastore cluster using folder
|
|
|
|
vmware_datastore_cluster:
|
|
|
|
hostname: '{{ vcenter_hostname }}'
|
|
|
|
username: '{{ vcenter_username }}'
|
|
|
|
password: '{{ vcenter_password }}'
|
|
|
|
validate_certs: no
|
2019-06-08 00:34:20 +02:00
|
|
|
folder: "{{ my_datastore_folder.result.path }}"
|
2019-05-21 12:25:43 +02:00
|
|
|
datastore_cluster_name: DSC2
|
|
|
|
state: present
|
|
|
|
register: add_dsc_folder_check
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- add_dsc_folder_check.changed
|
|
|
|
|
2018-03-09 05:44:15 +01:00
|
|
|
- name: Delete a datastore cluster to datacenter (check-mode)
|
|
|
|
vmware_datastore_cluster: &delete_datastore_cluster
|
2019-04-30 12:22:50 +02:00
|
|
|
hostname: '{{ vcenter_hostname }}'
|
|
|
|
username: '{{ vcenter_username }}'
|
|
|
|
password: '{{ vcenter_password }}'
|
2018-03-09 05:44:15 +01:00
|
|
|
validate_certs: no
|
|
|
|
datacenter_name: "{{ dc1 }}"
|
|
|
|
datastore_cluster_name: DSC1
|
|
|
|
state: absent
|
|
|
|
check_mode: yes
|
|
|
|
register: delete_dsc_check
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-04-30 12:22:50 +02:00
|
|
|
- delete_dsc_check.changed
|
2018-03-09 05:44:15 +01:00
|
|
|
|
2019-04-30 12:22:50 +02:00
|
|
|
- when: vcsim is not defined
|
|
|
|
block:
|
|
|
|
- name: Delete a datastore cluster to datacenter
|
|
|
|
vmware_datastore_cluster: *delete_datastore_cluster
|
|
|
|
register: delete_dsc_check
|
2018-03-09 05:44:15 +01:00
|
|
|
|
2019-04-30 12:22:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- delete_dsc_check.changed
|