ansible.builtin.icinga2_host (v2.9.27) — module

Manage a host in Icinga2

| "added in version" 2.5 of ansible.builtin"

Authors: Jurgen Brand (@t794104)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Add or remove a host to Icinga2 through the API.

See U(https://www.icinga.com/docs/icinga2/latest/doc/12-icinga2-api/)

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add host to icinga
  icinga2_host:
    url: "https://icinga2.example.com"
    url_username: "ansible"
    url_password: "a_secret"
    state: present
    name: "{{ ansible_fqdn }}"
    ip: "{{ ansible_default_ipv4.address }}"
  delegate_to: 127.0.0.1

Inputs

    
ip:
    description:
    - The IP address of the host.
    required: true

url:
    description:
    - HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path
    required: true

name:
    description:
    - Name used to create / delete the host. This does not need to be the FQDN, but does
      needs to be unique.
    required: true

zone:
    description:
    - The zone from where this host should be polled.

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Apply feature state.

template:
    description:
    - The template used to define the host.
    - Template cannot be modified after object creation.

use_proxy:
    default: 'yes'
    description:
    - If C(no), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

variables:
    description:
    - List of variables.

client_key:
    description:
    - PEM formatted file that contains your private key to be used for SSL client authentication.
      If C(client_cert) contains both the certificate and key, this option is not required.

client_cert:
    description:
    - 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, C(client_key)
      is not required.

display_name:
    default: if none is give it is the value of the <name> parameter
    description:
    - The name used to display the host.

url_password:
    description:
    - The password for use in HTTP basic authentication.
    - If the C(url_username) parameter is not specified, the C(url_password) parameter
      will not be used.

url_username:
    description:
    - The username for use in HTTP basic authentication.
    - This parameter can be used without C(url_password) for sites that allow empty passwords.

check_command:
    default: hostalive
    description:
    - The command used to check if the host is alive.

validate_certs:
    default: 'yes'
    description:
    - If C(no), SSL certificates will not be validated. This should only be used on personally
      controlled sites using self-signed certificates.
    type: bool

force_basic_auth:
    default: 'no'
    description:
    - 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.
    type: bool

Outputs

data:
  description: The data structure used for create, modify or delete of the host
  returned: always
  type: dict
name:
  description: The name used to create, modify or delete the host
  returned: always
  type: str