self-hosting/playbooks/icinga2.yml
2025-03-16 12:26:02 +01:00

46 lines
1.1 KiB
YAML

---
- name: Setup Icinga2 common things
gather_facts: false
hosts: all
tags: common
tasks:
- name: Install required packages
tags: install
become: true
ansible.builtin.apt:
name:
- icinga2
- monitoring-plugins-basic
- monitoring-plugins-common
- monitoring-plugins-standard
- monitoring-plugins-systemd
- monitoring-plugins-contrib
state: present
- name: Copy sudoers file for nagios as root (for check_smart)
become: true
ansible.builtin.copy:
content: 'nagios ALL=(root) NOPASSWD:/usr/lib/nagios/plugins/check_ide_smart'
dest: /etc/sudoers.d/nagios-smart
owner: root
group: root
mode: 0440
validate: 'visudo -cf %s'
- name: Setup Icinga2 master
gather_facts: true
hosts: lime2servers
roles:
- role: common_handlers
tags: always
- role: icinga2_master
tags: master
- name: Setup Icinga2 agent
gather_facts: true
hosts: mailservers
roles:
- role: common_handlers
tags: always
- role: icinga2_agent
tags: agent