mirror of https://github.com/ansible/ansible.git
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.
34 lines
974 B
YAML
34 lines
974 B
YAML
7 years ago
|
- name: store the vcenter container ip
|
||
|
set_fact:
|
||
|
vcsim: "{{ lookup('env', 'vcenter_host') }}"
|
||
|
- debug: var=vcsim
|
||
|
|
||
|
- name: kill vcsim
|
||
|
uri:
|
||
|
url: "{{ 'http://' + vcsim + ':5000/killall' }}"
|
||
|
- name: start vcsim
|
||
|
uri:
|
||
|
url: "{{ 'http://' + vcsim + ':5000/spawn?cluster=2' }}"
|
||
|
register: vcsim_instance
|
||
|
|
||
|
- name: get host facts
|
||
|
vmware_host_facts:
|
||
|
validate_certs: False
|
||
|
hostname: "{{ vcsim }}"
|
||
|
username: "{{ vcsim_instance['json']['username'] }}"
|
||
|
password: "{{ vcsim_instance['json']['password'] }}"
|
||
|
register: facts
|
||
|
|
||
|
- debug: var=facts
|
||
|
|
||
|
- name: get host info
|
||
|
uri:
|
||
|
url: "{{ 'http://' + vcsim + ':5000/govc_host_info' }}"
|
||
|
register: host_info_result
|
||
|
|
||
|
- name: verify some data,like ansible_processor
|
||
|
assert:
|
||
|
that:
|
||
|
- facts['ansible_facts']['ansible_hostname'] in host_info_result['json']
|
||
|
- facts['ansible_facts']['ansible_processor'] == host_info_result['json'][facts['ansible_facts']['ansible_hostname']]['Processor type']
|