1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: change default host_filter to gueststate (#32839)

This fix changes default value of host_filter in vmware_inventory.py
and vmware_inventory.ini to 'runtime.powerstate' from 'guest.gueststate'.
This change is added as 'guest.gueststate' requires vmware tools to be
installed on given VM, which may not be the case everytime.

Fixes: #25086

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-11-21 04:32:18 +00:00 committed by GitHub
parent a6feadbba3
commit d372cea2f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -67,8 +67,12 @@ password=vmware
# host_filters={{ config.guestid == 'rhel7_64Guest' }}
# host_filters={{ config.cpuhotremoveenabled != False }},{{ runtime.maxmemoryusage >= 512 }}
# host_filters={{ config.cpuhotremoveenabled != False }},{{ runtime.maxmemoryusage >= 512 }}
# The default is only gueststate of 'running'
#host_filters={{ guest.gueststate == "running" }}
# host_filters={{ runtime.powerstate == "poweredOn" }}
# host_filters={{ guest.gueststate == "notRunning" }}
# The default value is powerstate of virtual machine equal to "poweredOn". (Changed in version 2.5)
# Runtime state does not require to have vmware tools installed as compared to "guest.gueststate"
#host_filters={{ runtime.powerstate == "poweredOn" }}
# Groupby patterns enable the user to create groups via any possible jinja

View file

@ -254,7 +254,7 @@ class VMWareInventory(object):
'resourceconfig',
'alias_pattern': '{{ config.name + "_" + config.uuid }}',
'host_pattern': '{{ guest.ipaddress }}',
'host_filters': '{{ guest.gueststate == "running" }}',
'host_filters': '{{ runtime.powerstate == "poweredOn" }}',
'groupby_patterns': '{{ guest.guestid }},{{ "templates" if config.template else "guests"}}',
'lower_var_keys': True,
'custom_field_group_prefix': 'vmware_tag_',