2019-05-02 15:28:17 +02:00
|
|
|
- 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 }}"
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi1 }}'
|
2019-05-02 15:28:17 +02:00
|
|
|
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']"
|
2019-08-19 07:27:01 +02:00
|
|
|
- "'ansible_in_maintenance_mode' in facts['ansible_facts']"
|
|
|
|
- "'ansible_uptime' in facts['ansible_facts']"
|
2019-12-05 18:00:41 +01:00
|
|
|
- "'ansible_uuid' in facts['ansible_facts']"
|
2017-11-14 16:41:55 +01:00
|
|
|
|
2019-05-02 15:28:17 +02:00
|
|
|
- name: get host facts through from a host
|
|
|
|
vmware_host_facts:
|
|
|
|
validate_certs: False
|
2019-05-13 20:12:21 +02:00
|
|
|
hostname: '{{ esxi1 }}'
|
2019-05-16 15:36:48 +02:00
|
|
|
username: '{{ esxi_user }}'
|
|
|
|
password: '{{ esxi_password }}'
|
2019-05-02 15:28:17 +02:00
|
|
|
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']"
|
2019-08-19 07:27:01 +02:00
|
|
|
- "'ansible_in_maintenance_mode' in facts['ansible_facts']"
|
2019-10-07 06:57:57 +02:00
|
|
|
- "'ansible_uptime' in facts['ansible_facts']"
|
2019-12-05 18:00:41 +01:00
|
|
|
- "'ansible_uuid' in facts['ansible_facts']"
|
2019-10-07 06:57:57 +02:00
|
|
|
|
|
|
|
- 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']"
|