ansible/test/integration/targets/vmware_host_ssl_facts/tasks/main.yml
2019-02-26 11:29:21 -08:00

110 lines
2.7 KiB
YAML

# Test code for the vmware_host_ssl_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)
- 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
- debug:
var: vcsim_instance
- name: Wait for vcsim server to come up online
wait_for:
host: "{{ vcsim }}"
port: 443
state: started
- name: get a list of hosts from vcsim
uri:
url: http://{{ vcsim }}:5000/govc_find?filter=H
register: hosts
- name: get a list of clusters from vcsim
uri:
url: http://{{ vcsim }}:5000/govc_find?filter=CCR
register: clusters
- name: get a host
set_fact:
host1: "{{ hosts.json[0] | basename }}"
- name: get a cluster
set_fact:
cluster1: "{{ clusters.json[0] | basename }}"
- debug: var=host1
- debug: var=cluster1
- name: Gather SSL facts about ESXi machine
vmware_host_ssl_facts:
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
esxi_hostname: "{{ host1 }}"
validate_certs: no
register: ssl_facts
- debug: var=ssl_facts
- assert:
that:
- ssl_facts.host_ssl_facts is defined
- name: Gather facts about all hostsystem in given cluster
vmware_host_ssl_facts:
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
cluster_name: "{{ cluster1 }}"
validate_certs: no
register: ssl_facts
- debug: var=ssl_facts
- assert:
that:
- ssl_facts.host_ssl_facts is defined
- name: Gather SSL facts about ESXi machine in check mode
vmware_host_ssl_facts:
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
esxi_hostname: "{{ host1 }}"
validate_certs: no
check_mode: yes
register: ssl_facts
- debug: var=ssl_facts
- assert:
that:
- ssl_facts.host_ssl_facts is defined
- name: Gather facts about all hostsystem in given cluster in check mode ee
vmware_host_ssl_facts:
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
cluster_name: "{{ cluster1 }}"
validate_certs: no
check_mode: yes
register: ssl_facts
- debug: var=ssl_facts
- assert:
that:
- ssl_facts.host_ssl_facts is defined