mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Add ability to get vmware_guest_facts using vsphere schema output (#47446)
This commit is contained in:
committed by
ansibot
parent
7f50f467fe
commit
f2495ef0d3
@@ -1,7 +1,8 @@
|
||||
# Test code for the vmware_guest_facts module.
|
||||
# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
||||
# Copyright: (c) 2018, James E. King III (@jeking3) <jking@apache.org>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
---
|
||||
- name: store the vcenter container ip
|
||||
set_fact:
|
||||
vcsim: "{{ lookup('env', 'vcenter_host') }}"
|
||||
@@ -62,7 +63,7 @@
|
||||
folder: "{{ vm1 | dirname }}"
|
||||
register: guest_facts_0001
|
||||
|
||||
- debug: msg="{{ guest_facts_0001 }}"
|
||||
- debug: var=guest_facts_0001
|
||||
|
||||
- assert:
|
||||
that:
|
||||
@@ -98,7 +99,25 @@
|
||||
uuid: "{{ vm1_uuid }}"
|
||||
register: guest_facts_0002
|
||||
|
||||
- debug: msg="{{ guest_facts_0002 }}"
|
||||
- debug: var=guest_facts_0002
|
||||
|
||||
- name: "Get specific details about virtual machines using the vsphere output schema"
|
||||
vmware_guest_facts:
|
||||
validate_certs: False
|
||||
hostname: "{{ vcsim }}"
|
||||
username: "{{ vcsim_instance['json']['username'] }}"
|
||||
password: "{{ vcsim_instance['json']['password'] }}"
|
||||
datacenter: "{{ dc1 | basename }}"
|
||||
uuid: "{{ vm1_uuid }}"
|
||||
schema: vsphere
|
||||
properties:
|
||||
- config.hardware.memoryMB
|
||||
- guest
|
||||
- name
|
||||
- summary.runtime.connectionState
|
||||
register: guest_facts_0002b
|
||||
|
||||
- debug: var=guest_facts_0002b
|
||||
|
||||
- assert:
|
||||
that:
|
||||
@@ -106,14 +125,10 @@
|
||||
- "guest_facts_0002['instance']['hw_product_uuid'] is defined"
|
||||
- "guest_facts_0002['instance']['hw_product_uuid'] == vm1_uuid"
|
||||
- "guest_facts_0002['instance']['hw_cores_per_socket'] is defined"
|
||||
- "guest_facts_0001['instance']['hw_datastores'] is defined"
|
||||
- "guest_facts_0001['instance']['hw_esxi_host'] == h1 | basename"
|
||||
- "guest_facts_0001['instance']['hw_files'] is defined"
|
||||
- "guest_facts_0001['instance']['hw_guest_ha_state'] is defined"
|
||||
- "guest_facts_0001['instance']['hw_is_template'] is defined"
|
||||
- "guest_facts_0001['instance']['hw_folder'] is defined"
|
||||
- "guest_facts_0001['instance']['guest_question'] is defined"
|
||||
- "guest_facts_0001['instance']['guest_consolidation_needed'] is defined"
|
||||
- "guest_facts_0002b['instance']['config']['hardware']['memoryMB'] is defined"
|
||||
- "guest_facts_0002b['instance']['config']['hardware']['numCoresPerSocket'] is not defined"
|
||||
- "guest_facts_0002b['instance']['guest']['toolsVersion'] is defined"
|
||||
- "guest_facts_0002b['instance']['overallStatus'] is not defined"
|
||||
|
||||
# Testcase 0003: Get details about virtual machines without snapshots using UUID
|
||||
- name: get empty list of snapshots from virtual machine using UUID
|
||||
@@ -126,7 +141,7 @@
|
||||
uuid: "{{ vm1_uuid }}"
|
||||
register: guest_facts_0003
|
||||
|
||||
- debug: msg="{{ guest_facts_0003 }}"
|
||||
- debug: var=guest_facts_0003
|
||||
|
||||
- assert:
|
||||
that:
|
||||
@@ -169,7 +184,7 @@
|
||||
# uuid: "{{ vm1_uuid }}"
|
||||
# register: guest_facts_0004
|
||||
|
||||
#- debug: msg="{{ guest_facts_0004 }}"
|
||||
#- debug: var=guest_facts_0004
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
|
||||
Reference in New Issue
Block a user