telekom_mms.icinga_director.icinga_director_inventory inventory – Returns Ansible inventory from Icinga

Note

This inventory plugin is part of the telekom_mms.icinga_director collection (version 2.4.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 telekom_mms.icinga_director.

To use it in a playbook, specify: telekom_mms.icinga_director.icinga_director_inventory.

Synopsis

  • Returns Ansible inventory from Icinga

Parameters

Parameter

Comments

client_cert

path

PEM formatted certificate chain file to be used for SSL client authentication.

This file can also include the key as well, and if the key is included, `client_key` is not required.

client_key

path

PEM formatted file that contains your private key to be used for SSL client authentication.

If `client_cert` contains both the certificate and key, this option is not required.

compose

dictionary

Create vars from jinja2 expressions.

Default: {}

force

boolean

If yes do not get a cached copy.

Choices:

  • false ← (default)

  • true

force_basic_auth

boolean

Credentials specified with `url_username` and `url_password` should be passed in HTTP Header.

Choices:

  • false ← (default)

  • true

groups

dictionary

Add hosts to group based on Jinja2 conditionals.

Default: {}

http_agent

string

Header to identify as, generally appears in web server logs.

Default: "ansible-httpget"

keyed_groups

list / elements=dictionary

Add hosts to group based on the values of a variable.

Default: []

default_value

string

added in ansible-core 2.12

The default value when the host variable’s value is None or an empty string.

This option is mutually exclusive with keyed_groups[].trailing_separator.

key

string

The key from input dictionary used to generate groups.

parent_group

string

parent group for keyed group.

prefix

string

A keyed group name will start with this prefix.

Default: ""

separator

string

separator used to build the keyed group name.

Default: "_"

trailing_separator

boolean

added in ansible-core 2.12

Set this option to false to omit the keyed_groups[].separator after the host variable when the value is None or an empty string.

This option is mutually exclusive with keyed_groups[].default_value.

Choices:

  • false

  • true ← (default)

leading_separator

boolean

added in ansible-core 2.11

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.

Choices:

  • false

  • true ← (default)

plugin

string / required

Name of the plugin

Choices:

  • "telekom_mms.icinga_director.icinga_director_inventory"

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.

Choices:

  • false ← (default)

  • true

url

string / required

Icinga URL to connect to

url_password

string

The password for use in HTTP basic authentication.

If the `url_username` parameter is not specified, the `url_password` parameter will not be used.

url_username

string

The username for use in HTTP basic authentication.

This parameter can be used without `url_password` for sites that allow empty passwords

use_extra_vars

boolean

added in ansible-core 2.11

Merge extra vars into the available variables for composition (highest precedence).

Choices:

  • false ← (default)

  • true

Configuration:

use_gssapi

boolean

added in ansible-core 2.11

Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication.

Requires the Python library `gssapi <https://github.com/pythongssapi/python-gssapi>` to be installed.

Credentials for GSSAPI can be specified with `url_username`/ `url_password`

or with the GSSAPI env var `KRB5CCNAME` that specified a custom Kerberos credential cache.

NTLM authentication is `not` supported even if the GSSAPI mech for NTLM has been installed.

Choices:

  • false ← (default)

  • true

use_proxy

boolean

If `no`, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • false

  • true ← (default)

validate_certs

boolean

If `no`, SSL certificates will not be validated.

This should only be used on personally controlled sites using self-signed certificates.

Choices:

  • false

  • true ← (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 all and ungrouped groups will only reflect what previous inventory sources explicitly added to them.

  • Runtime ‘magic variables’ are not available during inventory construction. For example, groups and hostvars do not exist yet.

Examples

plugin: telekom_mms.icinga_director.icinga_director_inventory
url: 'https://example.com'
url_username: foo
url_password: bar
force_basic_auth: False
strict: False

# use the object_name you defined as hostname
compose:
  hostname: object_name

# create a group based on the operating system defined in a custom variable
keyed_groups:
  - prefix: os
    key: vars.HostOS

# create groups based on jinja templates
# here we create a group called "rb" if the host variable "check_period" is "24/7"
groups:
  rb: check_period == "24/7"

Authors

  • Sebastian Gumprich (@rndmh3ro)