mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
New Module vmware_host_facts (#26492)
Add new module vmware_host_facts ,it can get remote vmware host system info like setup module * modify ansible version * optimized output for human readable * add serial number get_system_facts() add ansible_product_serial * fix pep8 issue and ansible module required format * Use find_obj method instead get_obj * add ansible_hostname ansible_distribution_build * add integration test * vmware_host_facts integration test add verify * fix yamllint issue * fix boilerplate test * Update vmware_host_facts.py * fix RETURN key's name
This commit is contained in:
3
test/integration/targets/vmware_host_facts/aliases
Normal file
3
test/integration/targets/vmware_host_facts/aliases
Normal file
@@ -0,0 +1,3 @@
|
||||
posix/ci/cloud/vcenter
|
||||
cloud/vcenter
|
||||
|
||||
38
test/integration/targets/vmware_host_facts/tasks/main.yml
Normal file
38
test/integration/targets/vmware_host_facts/tasks/main.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
- name: make sure pyvmomi is installed
|
||||
pip:
|
||||
name: pyvmomi
|
||||
state: latest
|
||||
|
||||
- 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']
|
||||
Reference in New Issue
Block a user