Ansible roles for Icinga2 and Icinga Web 2

Typically I have only found other Icinga Ansible implementations linked from threads on this forum after writing my own… :roll_eyes: However I do generally find myself writing my own from scratch as I then find it easier to understand, fix, maintain and extend them.

I have a public demo repo that deploys a test network of a master and satellite nodes and agent nodes and also “passive” nodes that don’t run Icinga and these groups are defined as Ansible groups, each node apart from the icinga_master_node needs to have a icinga_parent_node defined and using a hosts.yml dictionary file they can be described like this:

---
all:
  vars:
    icinga_master_node: icinga-master.webarchitects.org.uk
  children:
    icinga_master_nodes:
      hosts:
        icinga-master.webarchitects.org.uk:
    icinga_satellite_nodes:
      hosts:
        icinga-satellite1.webarchitects.org.uk:
           icinga_parent_node: "{{ icinga_master_node }}"
        icinga-satellite2.webarchitects.org.uk:
          icinga_parent_node: "{{ icinga_master_node }}"
    icinga_agent_nodes:
      hosts:
        wsh.webarchitects.org.uk:
          icinga_parent_node: "{{ icinga_master_node }}"
        nextcloud.webarch.org.uk:
          icinga_parent_node: icinga-satellite1.webarchitects.org.uk
        dns5.webarch.info:
          icinga_parent_node: icinga-satellite1.webarchitects.org.uk
    icinga_passive_nodes:
      hosts:
        git.coop:
          icinga_parent_node: "{{ icinga_master_node }}"
        webarch.email:
          icinga_parent_node: "{{ icinga_master_node }}"
        dns2.webarch.info:
          icinga_parent_node: icinga-satellite1.webarchitects.org.uk
        dns3.webarch.info:
          icinga_parent_node: icinga-satellite1.webarchitects.org.uk
        dns0.webarchitects.co.uk:
          icinga_parent_node: icinga-satellite2.webarchitects.org.uk
        dns1.webarchitects.co.uk:
          icinga_parent_node: icinga-satellite2.webarchitects.org.uk
        members.webarchitects.coop:
          icinga_parent_node: icinga-satellite2.webarchitects.org.uk

And then all the check commands can either go in host_vars files for each node or can be added to the hosts.yml file like this:

        webarch.email:
          icinga_parent_node: "{{ icinga_master_node }}"
          icinga_check_commands:
            ping:
            mailcow:
              command: http
              args:
                http_ssl: 1
                http_string: "Webarchitects Co-operative Email"
                http_uri: /
            sogo:
              command: http
              args:
                http_ssl: 1
                http_string: "SOGo Groupware"
                http_uri: /SOGo/

Another example:

        dns5.webarch.info:
          icinga_parent_node: icinga-satellite1.webarchitects.org.uk
          icinga_check_commands:
            apt:
            disk:
            dns:
            dns_webarch_net:
              command: dns
              args:
                dns_authoritative: 1
                dns_server: dns5.webarch.info
                dns_lookup: www.webarch.net
            load:
              args:
                load_percpu: 1
            ping:
            ssh:
            swap:
            users:
              args:
                users_wgreater: 2
                users_cgreater: 4

The two key roles could do with more work and documentation and testing but they do work as they are:

The repo that builds a demo / dev / testing monitoring network using them is linked from the role repos above (I can’t link directly to it as this is a new account and therefore I’m limited to two external hyperlinks per post).

Hello and Welcome

The official Icinga Ansible playbooks are here:

There is plenty of work to be added to them and we welcome any contribute .

1 Like

Thanks for the welcome @aflatto I have had a read though most of the code and will have a think about what, if any, of the work I have done might make a suitable contribution.

We have renamed this Ansible group as “remote” nodes (I would have edited the above post but it seems post are set to become read-only after a while).