Note
This plugin is part of the hetzner.hcloud collection (version 1.6.0).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install hetzner.hcloud
.
To use it in a playbook, specify: hetzner.hcloud.hcloud
.
The below requirements are needed on the local controller node that executes this inventory.
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
compose dictionary | Default: {} | Create vars from jinja2 expressions. | |
connect_with string |
| Connect to the server using the value from this field. | |
groups dictionary | Default: {} | Add hosts to group based on Jinja2 conditionals. | |
images list / elements=string | Default: [] | Populate inventory with instances with this image name, only available for system images. | |
keyed_groups list / elements=string | Default: [] | Add hosts to group based on the values of a variable. | |
label_selector string | Default: "" | Populate inventory with instances with this label. | |
leading_separator boolean added in 2.11 of ansible.builtin |
| Use in conjunction with keyed_groups. By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore. This is because the default prefix is "" and the default separator is "_". Set this option to False to omit the leading underscore (or other separator) if no prefix is given. If the group name is derived from a mapping the separator is still used to concatenate the items. To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead. | |
locations list / elements=string | Default: [] | Populate inventory with instances in this location. | |
network string | Default: "" | Populate inventory with instances which are attached to this network name or ID. | |
plugin string / required |
| marks this as an instance of the "hcloud" plugin | |
strict boolean |
| If yes make invalid entries a fatal error, otherwise skip and continue.Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. | |
token string | The Hetzner Cloud API Token. | ||
token_env string | Default: "HCLOUD_TOKEN" | Environment variable to load the Hetzner Cloud API Token from. | |
types list / elements=string | Default: [] | Populate inventory with instances with this type. | |
use_extra_vars boolean added in 2.11 of ansible.builtin |
| ini entries: [inventory_plugins] env:ANSIBLE_INVENTORY_USE_EXTRA_VARS | Merge extra vars into the available variables for composition (highest precedence). |
# Minimal example. `HCLOUD_TOKEN` is exposed in environment. plugin: hcloud # Example with locations, types, groups and token plugin: hcloud token: foobar locations: - nbg1 types: - cx11 # Group by a location with prefix e.g. "hcloud_location_nbg1" # and image_os_flavor without prefix and separator e.g. "ubuntu" # and status with prefix e.g. "server_status_running" plugin: hcloud keyed_groups: - key: location prefix: hcloud_location - key: image_os_flavor separator: "" - key: status prefix: server_status
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/hetzner/hcloud/hcloud_inventory.html