noderings.cloud.noderings inventory – NodeRings virtual machines as an Ansible inventory
Note
This inventory plugin is part of the noderings.cloud collection (version 0.2.0).
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 noderings.cloud.
To use it in a playbook, specify: noderings.cloud.noderings.
New in noderings.cloud 0.1.0
Synopsis
Reads the organization’s virtual machines from the NodeRings API and adds them as hosts.
Hosts are grouped by tag (
noderings_tag_<tag>), city, country, hosting provider, plan code, billing type and power state. More groups and variables can be built withkeyed_groups,groupsandcompose.The inventory file name must end with
noderings.ymlornoderings.yaml.
Parameters
Parameter |
Comments |
|---|---|
Timeout in seconds for a single HTTP request. Default: |
|
A NodeRings service-account token. Can be a Jinja template, for example Configuration:
|
|
Base URL of the NodeRings API. Default: Configuration:
|
|
Toggle to enable/disable the caching of the inventory’s source data, requires a cache plugin setup to work. Choices:
Configuration:
|
|
Cache connection data or path, read cache plugin documentation for specifics. Configuration:
|
|
Cache plugin to use for the inventory’s source data. Default: Configuration:
|
|
Prefix to use for cache plugin files/tables. Default: Configuration:
|
|
Cache duration in seconds. Default: Configuration:
|
|
Create vars from jinja2 expressions. Default: |
|
Which address to set as Choices:
|
|
Add the built-in groups (tag, city, country, provider, plan code, billing type, power state). Choices:
|
|
Add hosts to group based on Jinja2 conditionals. Default: |
|
What to name each host.
Choices:
|
|
Add hosts to group based on the values of a variable. Default: |
|
The default value when the host variable’s value is This option is mutually exclusive with |
|
The key from input dictionary used to generate groups. |
|
parent group for keyed group. |
|
A keyed group name will start with this prefix. Default: |
|
separator used to build the keyed group name. Default: |
|
Set this option to This option is mutually exclusive with Choices:
|
|
Use in conjunction with 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 Set this option to 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. Choices:
|
|
Organization to read, sent as Configuration:
|
|
Must be Choices:
|
|
Only include VMs in these power states. Leave empty for all. Choices:
Default: |
|
If Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. Choices:
|
|
Only include VMs that have all of these tags. Default: |
|
Merge extra vars into the available variables for composition (highest precedence). Choices:
Configuration:
|
|
Whether to validate the API’s TLS certificate. Choices:
|
|
Prefix of the host variables holding the VM’s fields, for example Default: |
Note
Configuration entries listed above for each entry type (Ansible variable, environment variable, and so on) have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. The entry types are also ordered by precedence from low to high priority order. For example, an ansible.cfg entry (further up in the list) is overwritten by an Ansible variable (further down in the list).
Notes
Note
Inventories are not finalized at this stage, so the auto populated
allandungroupedgroups will only reflect what previous inventory sources explicitly added to them.Runtime ‘magic variables’ are not available during inventory construction. For example,
groupsandhostvarsdo not exist yet.
Examples
# noderings.yml: every VM, grouped automatically
plugin: noderings.cloud.noderings
# noderings.yml: only running production servers, plus a group per distro
plugin: noderings.cloud.noderings
tags: [prod]
states: [running]
keyed_groups:
- key: noderings_distro
prefix: distro
compose:
ansible_user: "'root'"
# noderings.yml: cache the API answer for five minutes
plugin: noderings.cloud.noderings
cache: true
cache_plugin: ansible.builtin.jsonfile
cache_connection: /tmp/noderings-inventory
cache_timeout: 300