bodsch.icinga2
Ansible Role: icinga2
This Ansible role is designed to set up an Icinga2 master or satellite server.
I'm currently moving this role to a collection, so I won't be addressing any issues or merge requests here anymore.
However, I will incorporate those into the collection!
Please be patient while I finish this work!
Requirements & Dependencies
Ansible Collections
To install it, use:
ansible-galaxy collection install bodsch.core
or
ansible-galaxy collection install --requirements-file collections.yml
Python Module
- dnspython
Supported Operating Systems
Tested on:
- ArchLinux
- Debian-based (Debian 10 / 11, Ubuntu 20.04)
- RedHat-based (Alma Linux 8, Rocky Linux 8, OracleLinux 8)
Contribution
Please refer to Contribution
Development Branches
The master
branch is my active development branch and may be unstable.
For a stable version, please use a Tagged Version.
Credits
- Michael Friedrich
- Nicolai Buchwitz
- Julien Tognazzi
- Carsten Köbke
- Jo. Fiedler
- and many others contributed to make Icinga2 successful
Please check the documentation for configuration details.
Documentation
Examples
A complete test setup can be found on GitLab under icinga2-infrastructure.
Icinga2 Master
Single Master Example
---
- host: icinga-master
vars:
icinga2_ido:
user: icinga2_ido
password: icinga2_ido
host: localhost
cleanup:
acknowledgements_age: 72h
icinga2_api:
user:
icinga2:
password: S0mh1TuFJI
permissions: '*'
icinga2_salt: 42T2fYT7bIxj5v291ajAW6kK0njvNMww8eWinBdEO5vh02xwC5qaNMMx77qNkYFE
icinga2_masters:
master-1.icinga.local:
icinga2_host_object:
master-1.icinga.local:
endpoint_name: master-1.icinga.local
zone: master
display_name: master-1.icinga.local
import: generic-host
address: '{{ ansible_default_ipv4.address }}'
vars: |
os = "Linux"
dist = "{{ ansible_distribution }}"
dist_ver = "{{ ansible_distribution_version }}"
disks = {
"disk /" = {
disk_partitions = "/"
}
}
services = [ "uptime", "memory" ]
roles:
- role: icinga2
Multi-Master Example
---
- host: icinga-master
vars:
icinga2_ido:
user: icinga2_ido
password: icinga2_ido
host: localhost
cleanup:
acknowledgements_age: 72h
icinga2_api:
user:
icinga2:
password: S0mh1TuFJI
permissions: '*'
icinga2_salt: 42T2fYT7bIxj5v291ajAW6kK0njvNMww8eWinBdEO5vh02xwC5qaNMMx77qNkYFE
icinga2_ha: true
icinga2_masters:
master-1.icinga.local:
# type: primary
ip: 192.168.130.20
port: 5665
master-2.icinga.local:
ip: 192.168.130.21
roles:
- role: icinga2
Icinga Satellite
Simple Satellite Example
---
- host: icinga-master
vars:
icinga2_mode: satellite
icinga2_salt: 42T2fYT7bIxj5v291ajAW6kK0njvNMww8eWinBdEO5vh02xwC5qaNMMx77qNkYFE
icinga2_masters:
master-1.icinga.local:
icinga2_host_object:
satellite-1.icinga.local:
endpoint_name: satellite-1.icinga.local
zone: "{{ icinga2_satellite_zone }}"
display_name: satellite-1.icinga.local
import: generic-host
address: '{{ ansible_default_ipv4.address }}'
vars: |
os = "Linux"
dist = "{{ ansible_distribution }}"
dist_ver = "{{ ansible_distribution_version }}"
satellite = true
disks = {
"disk /" = {
disk_partitions = "/"
}
}
services = [ "uptime" ]
roles:
- role: icinga2
Multi-Satellite Example with Zones
---
- host: icinga-master
vars:
icinga2_mode: satellite
icinga2_salt: 42T2fYT7bIxj5v291ajAW6kK0njvNMww8eWinBdEO5vh02xwC5qaNMMx77qNkYFE
icinga2_masters:
master-1.icinga.local:
icinga2_satellites:
zone1:
satellite-1.icinga.local:
ip: 192.168.130.30
satellite-2.icinga.local:
ip: 192.168.130.31
roles:
- role: icinga2
Tests
To run tests, use:
tox -e py38-ansible29 -- molecule
tox -e py38-ansible29 -- molecule -s icinga2-satellite
Troubleshooting & Known Issues
API Testing
You can test the API with the following commands:
export CURL_OPTS="--silent --insecure"
export ICINGA_CREDS="--user icinga2:S0mh1TuFJI"
export ICINGA_API_URL="https://master-1.icinga.local:5665/v1"
- Check API Listener status:
$ curl ${ICINGA_CREDS} ${CURL_OPTS} --header 'Accept: application/json' ${ICINGA_API_URL}/status/ApiListener | jq --raw-output ".results[].status.api.zones"
- Check Cluster Status:
$ curl ${ICINGA_CREDS} ${CURL_OPTS} --header 'Accept: application/json' ${ICINGA_API_URL}/status/CIB | jq --raw-output '.results[].status.uptime'
- Get API Listener status:
$ curl ${ICINGA_CREDS} ${CURL_OPTS} --header 'Accept: application/json' ${ICINGA_API_URL}/status/ApiListener | jq --raw-output ".results[].status.api"
- List Host Objects:
$ curl ${ICINGA_CREDS} ${CURL_OPTS} ${ICINGA_API_URL}/objects/hosts | jq
- Query a specific Host:
$ curl ${ICINGA_CREDS} ${CURL_OPTS} --header 'Accept: application/json' --header 'X-HTTP-Method-Override: GET' --request POST --data '{ "attrs": [ "name" ], "type": "Host", "filter": "host.name==\"master-1.icinga.local\"" }' ${ICINGA_API_URL}/objects/hosts
License
This project is licensed under the BSD 2-clause license.
Informazioni sul progetto
ansible role for handling icinga2 as master or satellite
Installa
ansible-galaxy install bodsch.icinga2
Licenza
bsd-2-clause
Download
1.5k
Proprietario
ex-developer (c, c++, php),
ex-system administrator / engineer,
keep-it-simple,
monitoring,
automation,
system architect