Ansible modules for Icinga Director

The modules are distributed as collections (https://docs.ansible.com/ansible/latest/user_guide/collections_using.html).
The installation is not quite forward, yet, since I could not publish the collection to Ansible Galaxy yet.

First, you have to install the icinga-collection. As it isn’t on Galaxy yet, you cannot do:

ansible-galaxy collection install T_Systems_MMS.icinga

Instead you have to clone, build and then install the collection:

git clone https://github.com/T-Systems-MMS/ansible-icinga-modules
cd ansible-icinga-modules
ansible-galaxy collection build
ansible-galaxy collection install T_Systems_MMS-icinga-*

Then you can run the play:

- hosts: localhost
  collections:
    - T_Systems_MMS.icinga-director
  tasks:
    - name: create a host in icinga
      icinga_host:
        state: present
        url: "https://example.com"
        url_username: "{{ icinga_user }}"
        url_password: "{{ icinga_pass }}"
        object_name: "{{ ansible_hostname }}"
        address: "{{ ansible_default_ipv4.address }}"
        display_name: "{{ ansible_hostname }}"
        groups:
          - "foo"
        imports:
          - "StandardServer"
        vars:
          dnscheck: "no"```
1 Like