ansible/test/integration/targets/vmware_host_facts/tasks/main.yml
sky-joker 7b7d266a39 VMware: add properties option to vmware_host_facts module (#62916)
* add properties option to vmware_host_facts
2019-10-07 10:27:57 +05:30

91 lines
3.4 KiB
YAML

- when: vcsim is not defined
block:
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
- name: get host facts through a vcenter
vmware_host_facts:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: '{{ esxi1 }}'
register: facts
- debug: var=facts
- name: verify some data,like ansible_processor
assert:
that:
- "'ansible_hostname' in facts['ansible_facts']"
- "'ansible_processor' in facts['ansible_facts']"
- "'ansible_in_maintenance_mode' in facts['ansible_facts']"
- "'ansible_uptime' in facts['ansible_facts']"
- name: get host facts through from a host
vmware_host_facts:
validate_certs: False
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
register: facts
- debug: var=facts
- name: verify some data,like ansible_processor
assert:
that:
- "'ansible_hostname' in facts['ansible_facts']"
- "'ansible_processor' in facts['ansible_facts']"
- "'ansible_in_maintenance_mode' in facts['ansible_facts']"
- "'ansible_uptime' in facts['ansible_facts']"
- name: get host properties facts through a vcenter
vmware_host_facts:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: '{{ esxi1 }}'
schema: vsphere
properties:
- hardware.memorySize
- hardware.cpuInfo.numCpuCores
- config.product.apiVersion
- overallStatus
register: facts
- debug: var=facts
- name: verify some data,like ansible_processor
assert:
that:
- "'hardware' in facts['ansible_facts']"
- "'config' in facts['ansible_facts']"
- "'overallStatus' in facts['ansible_facts']"
- "'memorySize' in facts['ansible_facts']['hardware']"
- "'cpuInfo' in facts['ansible_facts']['hardware']"
- "'numCpuCores' in facts['ansible_facts']['hardware']['cpuInfo']"
- "'product' in facts['ansible_facts']['config']"
- "'apiVersion' in facts['ansible_facts']['config']['product']"
- name: get host properties facts through from a host
vmware_host_facts:
validate_certs: False
hostname: '{{ esxi1 }}'
username: '{{ esxi_user }}'
password: '{{ esxi_password }}'
schema: vsphere
properties:
- hardware.memorySize
- hardware.cpuInfo.numCpuCores
- config.product.apiVersion
- overallStatus
register: facts
- debug: var=facts
- name: verify some data,like ansible_processor
assert:
that:
- "'hardware' in facts['ansible_facts']"
- "'config' in facts['ansible_facts']"
- "'overallStatus' in facts['ansible_facts']"
- "'memorySize' in facts['ansible_facts']['hardware']"
- "'cpuInfo' in facts['ansible_facts']['hardware']"
- "'numCpuCores' in facts['ansible_facts']['hardware']['cpuInfo']"
- "'product' in facts['ansible_facts']['config']"
- "'apiVersion' in facts['ansible_facts']['config']['product']"