This collection contains Ansible modules and a role to change objects in Icinga 2 using the director API.
Required Ansible version: 2.9
Currently supported modules:
icinga_command_template
icinga_command
icinga_endpoint
icinga_host_template
icinga_host
icinga_hostgroup
icinga_notification
icinga_notification_template
icinga_service
icinga_service_apply
icinga_service_template
icinga_servicegroup
icinga_timeperiod
icinga_user_template
icinga_user
icinga_zone
These modules are distributed as collections. To install them, run:
ansible-galaxy collection install t_systems_mms.icinga_director
Alternatively put the collection into a requirements.yml
-file:
---
collections:
- t_systems_mms.icinga_director
See the examples
directory for a complete list of examples.
- hosts: localhost
collections:
- t_systems_mms.icinga_director
tasks:
- name: create a host in icinga
t_systems_mms.icinga_director.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"
Please see the README of the role.
If the following error is thrown, check if you're behind a proxy and use force_basic_auth: true
in the task.
fatal: [localhost]: FAILED! => {"changed": false, "msg": "bad return code while creating: -1. Error message: Request failed: <urlopen error Tunnel connection failed: 302 Found>"}
- Linting with tox
> tox -elinters
- Integration tests with docker
# run icinga in a container and forward port 80
> docker run -d -p 80:80 jordan/icinga2
# run the ansible playbooks against the container
> ansible-playbook tests/integration/targets/icinga/normalmode.yml
> ansible-playbook tests/integration/targets/icinga/checkmode.yml
- Use our code snippets template supported in Visual Studio Code
Please see the README for more information.
GPLv3
- Sebastian Gumprich
- Lars Krahl
- Michaela Mattes