VMware: Add uptime and maintenance mode in vmware_host_facts (#60688)

* adding host facts
* adding to test
This commit is contained in:
Ryan Butler 2019-08-19 00:27:01 -05:00 committed by Abhijeet Kasurde
parent aea52c67d6
commit 555b8413a1
2 changed files with 8 additions and 0 deletions

View file

@ -110,6 +110,7 @@ ansible_facts:
"ansible_distribution_build": "4887370",
"ansible_distribution_version": "6.5.0",
"ansible_hostname": "10.76.33.100",
"ansible_in_maintenance_mode": true,
"ansible_interfaces": [
"vmk0"
],
@ -123,6 +124,7 @@ ansible_facts:
"ansible_product_name": "KVM",
"ansible_product_serial": "NA",
"ansible_system_vendor": "Red Hat",
"ansible_uptime": 1791680,
"ansible_vmk0": {
"device": "vmk0",
"ipv4": {
@ -277,6 +279,8 @@ class VMwareHostFactManager(PyVmomi):
'ansible_product_serial': sn,
'ansible_bios_date': self.host.hardware.biosInfo.releaseDate,
'ansible_bios_version': self.host.hardware.biosInfo.biosVersion,
'ansible_uptime': self.host.summary.quickStats.uptime,
'ansible_in_maintenance_mode': self.host.runtime.inMaintenanceMode,
}
return facts

View file

@ -18,6 +18,8 @@
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:
@ -32,3 +34,5 @@
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']"