community.general.icinga2_host module – Manage a host in Icinga2
Note
This module is part of the community.general collection (version 10.0.1).
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 community.general
.
To use it in a playbook, specify: community.general.icinga2_host
.
Synopsis
Add or remove a host to Icinga2 through the API.
See https://www.icinga.com/docs/icinga2/latest/doc/12-icinga2-api/
Parameters
Parameter |
Comments |
---|---|
The command used to check if the host is alive. Default: |
|
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, |
|
PEM formatted file that contains your private key to be used for SSL client authentication. If |
|
The name used to display the host. If not specified, it defaults to the value of the |
|
If Choices:
|
|
httplib2, the library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon initial request. Choices:
|
|
Header to identify as, generally appears in web server logs. Default: |
|
The IP address of the host. This is no longer required since community.general 8.0.0. |
|
Name used to create / delete the host. This does not need to be the FQDN, but does needs to be unique. |
|
Apply feature state. Choices:
|
|
The template used to define the host. Template cannot be modified after object creation. |
|
HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path |
|
The password for use in HTTP basic authentication. If the |
|
The username for use in HTTP basic authentication. This parameter can be used without |
|
Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library gssapi to be installed. Credentials for GSSAPI can be specified with NTLM authentication is not supported even if the GSSAPI mech for NTLM has been installed. Choices:
|
|
If Choices:
|
|
If Choices:
|
|
Dictionary of variables. |
|
The zone from where this host should be polled. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Add host to icinga
community.general.icinga2_host:
url: "https://icinga2.example.com"
url_username: "ansible"
url_password: "a_secret"
state: present
name: "{{ ansible_fqdn }}"
ip: "{{ ansible_default_ipv4.address }}"
variables:
foo: "bar"
delegate_to: 127.0.0.1
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The data structure used for create, modify or delete of the host Returned: always |
|
The name used to create, modify or delete the host Returned: always |