88 lines
1.9 KiB
YAML

---
- name: Ensure keyrings directory exists
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Download Icinga GPG key to keyrings
get_url:
url: https://packages.icinga.com/icinga.key
dest: /etc/apt/keyrings/icinga.asc
mode: '0644'
- name: Add Icinga APT repository (Ubuntu 24.04 "noble")
apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/icinga.asc] https://packages.icinga.com/ubuntu icinga-noble main"
state: present
filename: icinga
- name: Add Icinga 2 GPG key
apt_key:
url: https://packages.icinga.com/icinga.key
state: present
- name: Install Icinga 2
apt:
name: icinga2
state: present
update_cache: yes
# Include IDO DB setup tasks
- name: Setup Icinga2 IDO DB
include_tasks: icinga2-ido.yml
- name: Start and enable icinga2 service
service:
name: icinga2
state: started
enabled: yes
- name: Install Icinga Web 2 and Apache (optional)
when: icinga2_install_web
apt:
name:
- icingaweb2
- icingacli
- apache2
- php
- php-cli
- php-mysql
- php-xml
- php-gd
- php-imagick
- php-curl
state: present
- name: Enable Apache for Icinga Web
when: icinga2_install_web
service:
name: apache2
state: started
enabled: yes
- name: Configure Icinga Web 2 database (optional)
when: icinga2_install_web
debug:
msg: "You can add DB config, MySQL setup, etc. here."
- name: Install Icinga2 IDO MySQL module
apt:
name: icinga2-ido-mysql
state: present
- name: Enable the IDO MySQL feature
command: icinga2 feature enable ido-mysql
notify: Restart Icinga2
- name: Configure IDO DB connection
template:
src: ido-mysql.conf.j2
dest: /etc/icinga2/features-enabled/ido-mysql.conf
owner: root
group: root
mode: '0644'
notify: Restart Icinga2
- name: Setup Icinga2 Templates
include_tasks: icinga2-templates.yml