telekom_mms.icinga_director.icinga_host (2.1.0) — module

Manage hosts in Icinga2

| "added in version" 1.0.0 of telekom_mms.icinga_director"

Authors: Sebastian Gumprich (@rndmh3ro)

Install collection

Install with ansible-galaxy collection install telekom_mms.icinga_director:==2.1.0


Add to requirements.yml

  collections:
    - name: telekom_mms.icinga_director
      version: 2.1.0

Description

Add or remove a host to Icinga2 through the director API.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a host in icinga
  telekom_mms.icinga_director.icinga_host:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    accept_config: true
    address: "127.0.0.1"
    address6: "::1"
    check_command: hostalive
    check_interval: 90s
    check_timeout: 60
    command_endpoint: fooendpoint
    disabled: false
    display_name: "foohost"
    enable_active_checks: true
    enable_event_handler: false
    enable_flapping: false
    enable_notifications: true
    enable_passive_checks: false
    enable_perfdata: false
    flapping_threshold_high: "30.0"
    flapping_threshold_low: "25.0"
    has_agent: true
    icon_image_alt: "alt text"
    icon_image: "http://url1"
    master_should_connect: true
    max_check_attempts: 3
    object_name: "foohost"
    retry_interval: "1m"
    volatile: false
    groups:
      - "foohostgroup"
    imports:
      - "foohosttemplate"
    vars:
      dnscheck: "no"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: update a host in icinga
  telekom_mms.icinga_director.icinga_host:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: "foohost"
    notes: "example note"
    notes_url: "'http://url1' 'http://url2'"
    append: true

Inputs

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

vars:
    description:
    - Custom properties of the host.
    type: dict

zone:
    description:
    - Set the zone.
    type: str

force:
    default: false
    description:
    - If V(yes) do not get a cached copy.
    type: bool

notes:
    description:
    - Additional notes for this object.
    type: str
    version_added: 1.8.0
    version_added_collection: telekom_mms.icinga_director

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

append:
    choices:
    - true
    - false
    description:
    - Do not overwrite the whole object but instead append the defined properties.
    - Note - Appending to existing vars, imports or any other list/dict is not possible.
      You have to overwrite the complete list/dict.
    - Note - Variables that are set by default will also be applied, even if not set.
    type: bool
    version_added: 1.25.0
    version_added_collection: telekom_mms.icinga_director

groups:
    default: []
    description:
    - Hostgroups that should be directly assigned to this node. Hostgroups can be useful
      for various reasons.
    - You might assign service checks based on assigned hostgroup. They are also often
      used as an instrument to enforce restricted views in Icinga Web 2.
    - Hostgroups can be directly assigned to single hosts or to host templates.
    - You might also want to consider assigning hostgroups using apply rules.
    elements: str
    type: list

address:
    description:
    - Host address. Usually an IPv4 address, but may be any kind of address your check
      plugin is able to deal with.
    type: str

imports:
    description:
    - Choose a Host Template. Required when state is C(present).
    - Required if I(state) is C(present).
    elements: str
    type: list

address6:
    description:
    - Host IPv6 address. Usually an IPv6 address, but may be any kind of address your
      check plugin is able to deal with.
    type: str
    version_added: 1.4.0
    version_added_collection: telekom_mms.icinga_director

disabled:
    choices:
    - true
    - false
    default: false
    description:
    - Disabled objects will not be deployed.
    type: bool

volatile:
    choices:
    - true
    - false
    description:
    - Whether this check is volatile.
    type: bool

has_agent:
    choices:
    - true
    - false
    description:
    - Whether this host has the Icinga 2 Agent installed.
    type: bool
    version_added: 1.9.0
    version_added_collection: telekom_mms.icinga_director

notes_url:
    description:
    - An URL pointing to additional notes for this object.
    - Separate multiple urls like this "'http://url1' 'http://url2'".
    - Maximum length is 255 characters.
    type: str
    version_added: 1.8.0
    version_added_collection: telekom_mms.icinga_director

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

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

http_agent:
    default: ansible-httpget
    description:
    - Header to identify as, generally appears in web server logs.
    type: str

icon_image:
    description:
    - An URL pointing to an icon for this object.
    - Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for
      items from the Icinga icon font
    type: str

use_gssapi:
    default: false
    description:
    - Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos
      through Negotiate authentication.
    - Requires the Python library L(gssapi,https://github.com/pythongssapi/python-gssapi)
      to be installed.
    - Credentials for GSSAPI can be specified with O(url_username)/O(url_password) or
      with the GSSAPI env var C(KRB5CCNAME) that specified a custom Kerberos credential
      cache.
    - NTLM authentication is B(not) supported even if the GSSAPI mech for NTLM has been
      installed.
    type: bool
    version_added: '2.11'
    version_added_collection: ansible.builtin

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, O(client_key)
      is not required.
    type: path

object_name:
    aliases:
    - name
    description:
    - Icinga object name for this host.
    - This is usually a fully qualified host name but it could basically be any kind of
      string.
    - To make things easier for your users we strongly suggest to use meaningful names
      for templates.
    - For example "generic-host" is ugly, "Standard Linux Server" is easier to understand.
    required: true
    type: str

check_period:
    description:
    - The name of a time period which determines when this object should be monitored.
      Not limited by default.
    type: str

display_name:
    description:
    - Alternative name for this host. Might be a host alias or and kind of string helping
      your users to identify this host.
    type: str

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

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

accept_config:
    choices:
    - true
    - false
    description:
    - Whether the agent is configured to accept config.
    type: bool
    version_added: 1.9.0
    version_added_collection: telekom_mms.icinga_director

check_command:
    description:
    - The name of the check command.
    - Though this is not required to be defined in the director, you still have to supply
      a check_command in a host or host-template.
    type: str

check_timeout:
    description:
    - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute
    type: str

event_command:
    description:
    - Event command for host which gets called on every check execution if one of these
      conditions matches
    - The host is in a soft state
    - The host state changes into a hard state
    - The host state recovers from a soft or hard state to OK/Up
    type: str

check_interval:
    description:
    - Your regular check interval.
    type: str

icon_image_alt:
    description:
    - Alternative text to be shown in case above icon is missing
    type: str

retry_interval:
    description:
    - Retry interval, will be applied after a state change unless the next hard state
      is reached.
    type: str

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

enable_flapping:
    choices:
    - true
    - false
    description:
    - Whether flap detection is enabled on this object.
    type: bool

enable_perfdata:
    choices:
    - true
    - false
    description:
    - Whether to process performance data provided by this object.
    type: bool

command_endpoint:
    description:
    - The endpoint where commands are executed on.
    type: str

force_basic_auth:
    default: false
    description:
    - Credentials specified with O(url_username) and O(url_password) should be passed
      in HTTP Header.
    type: bool

max_check_attempts:
    description:
    - Defines after how many check attempts a new hard state is reached.
    type: str

enable_active_checks:
    choices:
    - true
    - false
    description:
    - Whether to actively check this object.
    type: bool

enable_event_handler:
    choices:
    - true
    - false
    description:
    - Whether to enable event handlers this object.
    type: bool

enable_notifications:
    choices:
    - true
    - false
    description:
    - Whether to send notifications for this object.
    type: bool

enable_passive_checks:
    choices:
    - true
    - false
    description:
    - Whether to accept passive check results for this object.
    type: bool

master_should_connect:
    choices:
    - true
    - false
    description:
    - Whether the parent (master) node should actively try to connect to this agent.
    type: bool
    version_added: 1.9.0
    version_added_collection: telekom_mms.icinga_director

flapping_threshold_low:
    description:
    - Flapping lower bound in percent for a service to be considered not flapping
    type: str

flapping_threshold_high:
    description:
    - Flapping upper bound in percent for a service to be considered flapping
    type: str