tribe29.checkmk.host (0.23.0) — module

Manage hosts in Checkmk.

| "added in version" 0.0.1 of tribe29.checkmk"

Authors: Robin Gierse (@robin-tribe29), Lars Getwan (@lgetwan), Oliver Gaida (@ogaida)

Install collection

Install with ansible-galaxy collection install tribe29.checkmk:==0.23.0


Add to requirements.yml

  collections:
    - name: tribe29.checkmk
      version: 0.23.0

Description

Manage hosts within Checkmk.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a host.
- name: "Create a host."
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    folder: "/"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a host with IP.
- name: "Create a host with IP address."
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    attributes:
      alias: "My Host"
      ipaddress: "127.0.0.1"
    folder: "/"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a host which is monitored on a distinct site.
- name: "Create a host which is monitored on a distinct site."
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    attributes:
      site: "my_remote_site"
    folder: "/"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a host with update_attributes.
- name: "Create a host which is monitored on a distinct site."
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    update_attributes:
      site: "my_remote_site"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update only specified attributes
- name: "Update only specified attributes"
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    update_attributes:
      alias: "foo"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove specified attributes
- name: "Remove specified attributes"
  tribe29.checkmk.host:
    server_url: "http://localhost/"
    site: "my_site"
    automation_user: "automation"
    automation_secret: "$SECRET"
    name: "my_host"
    remove_attributes:
      - alias
    state: "present"

Inputs

    
name:
    aliases:
    - host_name
    description: The host you want to manage.
    required: true
    type: str

site:
    description: The site you want to connect to.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description: The state of your host.
    type: str

folder:
    description: The folder your host is located in. On create it defaults to C(/).
    type: str

attributes:
    default: {}
    description:
    - The attributes of your host as described in the API documentation. B(Attention!
      This option OVERWRITES all existing attributes!)
    type: raw

server_url:
    description: The base url of your Checkmk server.
    required: true
    type: str

validate_certs:
    default: true
    description: Whether to validate the SSL certificate of the Checkmk server.
    type: bool

automation_user:
    description: The automation user you want to use. It has to be an 'Automation' user,
      not a normal one.
    required: true
    type: str

automation_secret:
    description: The secret to authenticate your automation user.
    required: true
    type: str

remove_attributes:
    default: []
    description:
    - The remove_attributes of your host as described in the API documentation. This will
      only remove the given attributes.
    type: raw

update_attributes:
    default: {}
    description:
    - The update_attributes of your host as described in the API documentation. This will
      only update the given attributes.
    type: raw

Outputs

message:
  description: The output message that the module generates. Contains the API response
    details in case of an error.
  returned: always
  sample: Host created.
  type: str