| 1 |
# Ansible VMware external inventory script settings |
| 2 |
|
| 3 |
[vmware] |
| 4 |
|
| 5 |
# The resolvable hostname or ip address of the vsphere |
| 6 |
server=vcenter |
| 7 |
|
| 8 |
# The port for the vsphere API |
| 9 |
#port=443 |
| 10 |
|
| 11 |
# The username with access to the vsphere API. This setting |
| 12 |
# may also be defined via the VMWARE_USERNAME environment variable. |
| 13 |
[email protected] |
| 14 |
|
| 15 |
# The password for the vsphere API. This setting |
| 16 |
# may also be defined via the VMWARE_PASSWORD environment variable. |
| 17 |
password=vmware |
| 18 |
|
| 19 |
# Verify the server's SSL certificate |
| 20 |
#validate_certs = True |
| 21 |
|
| 22 |
# Specify the number of seconds to use the inventory cache before it is |
| 23 |
# considered stale. If not defined, defaults to 0 seconds. |
| 24 |
#cache_max_age = 3600 |
| 25 |
|
| 26 |
|
| 27 |
# Specify the directory used for storing the inventory cache. If not defined, |
| 28 |
# caching will be disabled. |
| 29 |
#cache_path = ~/.cache/ansible |
| 30 |
|
| 31 |
|
| 32 |
# Max object level refers to the level of recursion the script will delve into |
| 33 |
# the objects returned from pyvomi to find serializable facts. The default |
| 34 |
# level of 0 is sufficient for most tasks and will be the most performant. |
| 35 |
# Beware that the recursion can exceed python's limit (causing traceback), |
| 36 |
# cause sluggish script performance and return huge blobs of facts. |
| 37 |
# If you do not know what you are doing, leave this set to 1. |
| 38 |
#max_object_level=1 |
| 39 |
|
| 40 |
|
| 41 |
# Lower the keynames for facts to make addressing them easier. |
| 42 |
#lower_var_keys=True |
| 43 |
|
| 44 |
|
| 45 |
# Don't retrieve and process some VMware attribute keys |
| 46 |
# Default values permit to sanitize inventory meta and to improve a little bit |
| 47 |
# performance by removing non-common group attributes. |
| 48 |
#skip_keys = declaredalarmstate,disabledmethod,dynamicproperty,dynamictype,environmentbrowser,managedby,parent,childtype,resourceconfig |
| 49 |
|
| 50 |
|
| 51 |
# Host alias for objects in the inventory. VMware allows duplicate VM names |
| 52 |
# so they can not be considered unique. Use this setting to alter the alias |
| 53 |
# returned for the hosts. Any atributes for the guest can be used to build |
| 54 |
# this alias. The default combines the config name and the config uuid and |
| 55 |
# expects that the ansible_host will be set by the host_pattern. |
| 56 |
#alias_pattern={{ config.name + '_' + config.uuid }} |
| 57 |
|
| 58 |
|
| 59 |
# Host pattern is the value set for ansible_host and ansible_ssh_host, which |
| 60 |
# needs to be a hostname or ipaddress the ansible controlhost can reach. |
| 61 |
#host_pattern={{ guest.ipaddress }} |
| 62 |
|
| 63 |
|
| 64 |
# Host filters are a comma separated list of jinja patterns to remove |
| 65 |
# non-matching hosts from the final result. |
| 66 |
# EXAMPLES: |
| 67 |
# host_filters={{ config.guestid == 'rhel7_64Guest' }} |
| 68 |
# host_filters={{ config.cpuhotremoveenabled != False }},{{ runtime.maxmemoryusage >= 512 }} |
| 69 |
# host_filters={{ config.cpuhotremoveenabled != False }},{{ runtime.maxmemoryusage >= 512 }} |
| 70 |
# host_filters={{ runtime.powerstate == "poweredOn" }} |
| 71 |
# host_filters={{ guest.gueststate == "notRunning" }} |
| 72 |
# The default value is powerstate of virtual machine equal to "poweredOn". (Changed in version 2.5) |
| 73 |
# Runtime state does not require to have vmware tools installed as compared to "guest.gueststate" |
| 74 |
#host_filters={{ runtime.powerstate == "poweredOn" }} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
# Groupby patterns enable the user to create groups via any possible jinja |
| 79 |
# expression. The resulting value will the groupname and the host will be added |
| 80 |
# to that group. Be careful to not make expressions that simply return True/False |
| 81 |
# because those values will become the literal group name. The patterns can be |
| 82 |
# comma delimited to create as many groups as necessary |
| 83 |
#groupby_patterns={{ guest.guestid }},{{ 'templates' if config.template else 'guests'}} |
| 84 |
|
| 85 |
# Group by custom fields will use VMware custom fields to generate hostgroups |
| 86 |
# based on {{ custom_field_group_prefix }} + field_name + _ + field_value |
| 87 |
# Set groupby_custom_field to True will enable this feature |
| 88 |
# If custom field value is comma separated, multiple groups are created. |
| 89 |
# Warning: This required max_object_level to be set to 2 or greater. |
| 90 |
#groupby_custom_field = False |
| 91 |
|
| 92 |
# You can customize prefix used by custom field hostgroups generation here. |
| 93 |
# vmware_tag_ prefix is the default and consistent with ec2_tag_ |
| 94 |
#custom_field_group_prefix = vmware_tag_ |
| 95 |
|
| 96 |
# You can blacklist custom fields so that they are not included in the |
| 97 |
# groupby_custom_field option. This is useful when you have custom fields that |
| 98 |
# have values that are unique to individual hosts. Timestamps for example. |
| 99 |
# The groupby_custom_field_excludes option should be a comma separated list of custom |
| 100 |
# field keys to be blacklisted. |
| 101 |
#groupby_custom_field_excludes=<custom_field_1>,<custom_field_2>,<custom_field_3> |
| 102 |
|
| 103 |
# The script attempts to recurse into virtualmachine objects and serialize |
| 104 |
# all available data. The serialization is comprehensive but slow. If the |
| 105 |
# vcenter environment is large and the desired properties are known, create |
| 106 |
# a 'properties' section in this config and make an arbitrary list of |
| 107 |
# key=value settings where the value is a path to a specific property. If |
| 108 |
# If this feature is enabled, be sure to fetch every property that is used |
| 109 |
# in the jinja expressions defined above. For performance tuning, reduce |
| 110 |
# the number of properties to the smallest amount possible and limit the |
| 111 |
# use of properties that are not direct attributes of vim.VirtualMachine |
| 112 |
#[properties] |
| 113 |
#prop01=name |
| 114 |
#prop02=config.cpuHotAddEnabled |
| 115 |
#prop03=config.cpuHotRemoveEnabled |
| 116 |
#prop04=config.instanceUuid |
| 117 |
#prop05=config.hardware.numCPU |
| 118 |
#prop06=config.template |
| 119 |
#prop07=config.name |
| 120 |
#prop08=guest.hostName |
| 121 |
#prop09=guest.ipAddress |
| 122 |
#prop10=guest.guestId |
| 123 |
#prop11=guest.guestState |
| 124 |
#prop12=runtime.maxMemoryUsage |
| 125 |
# In order to populate `customValue` (virtual machine's custom attributes) inside hostvars, |
| 126 |
# uncomment following property. Please see - https://github.com/ansible/ansible/issues/41395 |
| 127 |
#prop13=customValue |