34 lines
845 B
YAML
34 lines
845 B
YAML
---
|
|
- name: Install Icinga 2 and monitoring plugins
|
|
ansible.builtin.apt:
|
|
name:
|
|
- icinga2
|
|
- monitoring-plugins
|
|
state: latest
|
|
|
|
- name: Set up Icinga 2 API if not already configured
|
|
ansible.builtin.command: icinga2 api setup
|
|
args:
|
|
creates: /etc/icinga2/features-enabled/api.conf
|
|
notify: restart icinga2
|
|
|
|
- name: Configure API root user
|
|
ansible.builtin.template:
|
|
src: api-users.conf.j2
|
|
dest: /etc/icinga2/conf.d/api-users.conf
|
|
owner: nagios
|
|
group: nagios
|
|
mode: '0640'
|
|
notify: restart icinga2
|
|
|
|
- name: Enable Icinga DB feature
|
|
ansible.builtin.command: icinga2 feature enable icingadb
|
|
args:
|
|
creates: /etc/icinga2/features-enabled/icingadb.conf
|
|
notify: restart icinga2
|
|
|
|
- name: Enable and start Icinga 2
|
|
ansible.builtin.systemd:
|
|
name: icinga2
|
|
enabled: true
|
|
state: started
|