39 lines
1 KiB
YAML
39 lines
1 KiB
YAML
---
|
|
- name: Install Icinga DB components
|
|
ansible.builtin.apt:
|
|
name:
|
|
- icingadb
|
|
- icingadb-redis
|
|
- icingaweb2-module-icingadb
|
|
state: latest
|
|
|
|
- name: Enable and start Icinga DB Redis
|
|
ansible.builtin.systemd:
|
|
name: icingadb-redis
|
|
enabled: true
|
|
state: started
|
|
|
|
- name: Check whether Icinga DB schema is already imported
|
|
ansible.builtin.shell: "mysql --batch --skip-column-names {{ icingadb_database }} -e 'SHOW TABLES LIKE \"host\";'"
|
|
register: icingadb_schema_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Import Icinga DB schema
|
|
ansible.builtin.shell: "mysql {{ icingadb_database }} < /usr/share/icingadb/schema/mysql/schema.sql"
|
|
when: icingadb_schema_check.stdout | length == 0
|
|
|
|
- name: Configure Icinga DB daemon
|
|
ansible.builtin.template:
|
|
src: config.yml.j2
|
|
dest: /etc/icingadb/config.yml
|
|
owner: root
|
|
group: icingadb
|
|
mode: '0640'
|
|
notify: restart icingadb
|
|
|
|
- name: Enable and start Icinga DB
|
|
ansible.builtin.systemd:
|
|
name: icingadb
|
|
enabled: true
|
|
state: started
|