2018-01-11 09:10:37 +01:00
|
|
|
# Test code for the vmware_host_config_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-05-02 15:28:17 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
|
|
|
vars:
|
|
|
|
setup_attach_host: true
|
2018-01-11 09:10:37 +01:00
|
|
|
|
|
|
|
- name: gather facts about all hosts in given cluster
|
|
|
|
vmware_host_config_facts:
|
2019-05-02 15:28:17 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2018-01-11 09:10:37 +01:00
|
|
|
validate_certs: no
|
|
|
|
cluster_name: "{{ ccr1 }}"
|
|
|
|
register: all_hosts_result
|
|
|
|
|
2019-05-02 15:28:17 +02:00
|
|
|
- debug:
|
|
|
|
var: all_hosts_result
|
2018-01-11 09:10:37 +01:00
|
|
|
|
|
|
|
- name: ensure facts are gathered for all hosts
|
|
|
|
assert:
|
|
|
|
that:
|
2019-05-02 15:28:17 +02:00
|
|
|
- all_hosts_result.hosts_facts
|
2018-10-03 14:55:40 +02:00
|
|
|
|
|
|
|
- name: gather facts about all hosts in given cluster in check mode
|
|
|
|
vmware_host_config_facts:
|
2019-05-02 15:28:17 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2018-10-03 14:55:40 +02:00
|
|
|
validate_certs: no
|
|
|
|
cluster_name: "{{ ccr1 }}"
|
|
|
|
register: all_hosts_result_check_mode
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- name: ensure facts are gathered for all hosts
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- all_hosts_result_check_mode.hosts_facts
|
|
|
|
|
2019-05-02 15:28:17 +02:00
|
|
|
- when: vcsim is not defined
|
|
|
|
block:
|
|
|
|
- name: gather facts about a given host in check mode
|
|
|
|
vmware_host_config_facts:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: "{{ esxi1 }}"
|
2019-05-02 15:28:17 +02:00
|
|
|
register: single_hosts_result_check_mode
|
|
|
|
check_mode: yes
|
|
|
|
- name: ensure facts are gathered for all hosts
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- single_hosts_result_check_mode.hosts_facts
|
|
|
|
|
|
|
|
- name: gather facts about a given host
|
|
|
|
vmware_host_config_facts:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: "{{ esxi1 }}"
|
2019-05-02 15:28:17 +02:00
|
|
|
register: single_hosts_result
|
|
|
|
- name: ensure facts are gathered for all hosts
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- single_hosts_result.hosts_facts
|