You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/vmware_datastore_cluster/tasks/main.yml

95 lines
2.3 KiB
YAML

# 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)
- name: Wait for Flask controller to come up online
wait_for:
host: '{{ vcsim }}'
port: 5000
state: started
- name: Kill vcsim
uri:
url: http://{{ vcsim }}:5000/killall
- name: Start vcsim
uri:
url: http://{{ vcsim }}:5000/spawn?cluster=2
register: vcsim_instance
- name: Wait for Flask controller to come up online
wait_for:
host: '{{ vcsim }}'
port: 443
state: started
- debug:
var: vcsim_instance
- name: Get datacenter
uri:
url: http://{{ vcsim }}:5000/govc_find?filter=DC
register: datacenters
- name: store the vcenter container ip
set_fact:
dc1: "{{ datacenters['json'][0] | basename }}"
- name: Add a datastore cluster to datacenter (check-mode)
vmware_datastore_cluster: &add_datastore_cluster
hostname: '{{ vcsim }}'
username: '{{ vcsim_instance.json.username }}'
password: '{{ vcsim_instance.json.password }}'
validate_certs: no
datacenter_name: "{{ dc1 }}"
datastore_cluster_name: DSC1
state: present
check_mode: yes
register: add_dsc_check
- assert:
that:
- add_dsc_check.changed == true
- name: Add a datastore cluster to datacenter
vmware_datastore_cluster: *add_datastore_cluster
register: add_dsc
- assert:
that:
- add_dsc.changed == true
- name: Add a datastore cluster to datacenter again
vmware_datastore_cluster: *add_datastore_cluster
register: add_dsc
- assert:
that:
- add_dsc.changed == false
- name: Delete a datastore cluster to datacenter (check-mode)
vmware_datastore_cluster: &delete_datastore_cluster
hostname: '{{ vcsim }}'
username: '{{ vcsim_instance.json.username }}'
password: '{{ vcsim_instance.json.password }}'
validate_certs: no
datacenter_name: "{{ dc1 }}"
datastore_cluster_name: DSC1
state: absent
check_mode: yes
register: delete_dsc_check
- assert:
that:
- delete_dsc_check.changed == true
# TODO: vcsim does not support delete operation on datastore cluster
#- name: Delete a datastore cluster to datacenter
# vmware_datastore_cluster: *delete_datastore_cluster
# register: delete_dsc_check
#- assert:
# that:
# - delete_dsc_check.changed == true