- Docs »
- hetzner.hcloud.hcloud – Ansible dynamic inventory plugin for the Hetzner Cloud.
-
You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the latest stable released version.
hetzner.hcloud.hcloud – Ansible dynamic inventory plugin for the Hetzner Cloud.
Note
This plugin is part of the hetzner.hcloud collection (version 1.2.1).
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.
python >= 2.7
hcloud-python >= 1.0.0
Parameter |
Choices/Defaults |
Configuration |
Comments |
compose
dictionary
|
Default:
{}
|
|
Create vars from jinja2 expressions.
|
connect_with
string
|
Choices:
public_ipv4 ←
- hostname
- ipv4_dns_ptr
- private_ipv4
|
|
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.
|
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.
|
# 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