2018-04-19 11:41:04 +02:00
|
|
|
# Test code for the vmware_cluster_facts 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 11:38:44 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
2018-04-19 11:41:04 +02:00
|
|
|
|
2019-04-30 11:38:44 +02:00
|
|
|
- &vc_all_data
|
|
|
|
name: gather facts about all clusters in the given datacenter
|
2018-04-19 11:41:04 +02:00
|
|
|
vmware_cluster_facts:
|
2019-04-30 11:38:44 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2018-04-19 11:41:04 +02:00
|
|
|
validate_certs: False
|
2019-04-30 11:38:44 +02:00
|
|
|
datacenter: "{{ dc1 }}"
|
2018-04-19 11:41:04 +02:00
|
|
|
register: all_cluster_result
|
|
|
|
|
2019-04-30 11:38:44 +02:00
|
|
|
- &ensure_vc_all_data
|
|
|
|
name: ensure facts are gathered for all clusters
|
2018-04-19 11:41:04 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- all_cluster_result.clusters
|
|
|
|
- not all_cluster_result.changed
|
|
|
|
|
2019-04-30 11:38:44 +02:00
|
|
|
- <<: *vc_all_data
|
|
|
|
name: Gather facts about all clusters in the given datacenter in check mode
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- debug: msg=all_cluster_result
|
|
|
|
|
|
|
|
# vmware_cluster_facts does not support check mode
|
|
|
|
# - <<: *ensure_vc_all_data
|
|
|
|
# name: Ensure facts are gathered for all clusters in check mode
|
|
|
|
|
|
|
|
- &vc_cluster_data
|
|
|
|
name: Gather facts about the given cluster
|
2018-04-19 11:41:04 +02:00
|
|
|
vmware_cluster_facts:
|
2019-04-30 11:38:44 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2018-04-19 11:41:04 +02:00
|
|
|
validate_certs: False
|
2019-04-30 11:38:44 +02:00
|
|
|
cluster_name: "{{ ccr1 }}"
|
2018-04-19 11:41:04 +02:00
|
|
|
register: cluster_result
|
|
|
|
|
2019-04-30 11:38:44 +02:00
|
|
|
- &ensure_vc_cluster_data
|
|
|
|
name: Ensure facts are gathered for the given cluster
|
2018-04-19 11:41:04 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- cluster_result.clusters
|
2019-04-30 11:38:44 +02:00
|
|
|
- not cluster_result.changed
|
|
|
|
|
|
|
|
- <<: *vc_cluster_data
|
|
|
|
name: Gather facts about the given cluster in check mode
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
# vmware_cluster_facts does not support check mode
|
|
|
|
# - <<: *ensure_vc_cluster_data
|
|
|
|
# name: Ensure facts are gathered for the given cluster in check mode
|