diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-10-05 03:47:16 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-10-05 03:47:16 +0200 |
commit | e5df302e3c17c29f16427c5cf35a0d45ffd7aac6 (patch) | |
tree | c02a7eae5dc8fc44d327f75a1504af8dffbd3504 /roles/icinga2/tasks/icinga.yml | |
parent | 89b4408e0b91ee670bda0c6ea5a1f9d183e2504a (diff) | |
download | ansible_collection-e5df302e3c17c29f16427c5cf35a0d45ffd7aac6.tar.gz |
icinga2: WIP
Diffstat (limited to 'roles/icinga2/tasks/icinga.yml')
-rw-r--r-- | roles/icinga2/tasks/icinga.yml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/roles/icinga2/tasks/icinga.yml b/roles/icinga2/tasks/icinga.yml new file mode 100644 index 0000000..ec6fe1e --- /dev/null +++ b/roles/icinga2/tasks/icinga.yml @@ -0,0 +1,58 @@ +--- +- name: Install icinga2.conf + template: + src: icinga2.conf.j2 + dest: /etc/icinga2/icinga2.conf + owner: nagios + group: nagios + become: yes + notify: Restart icinga + +- name: IDO Database + mysql_db: + name: ido + state: present + login_unix_socket: /var/run/mysqld/mysqld.sock + become: yes + register: ido_db + +- name: IDO Database schema import + mysql_db: + name: ido + target: '/usr/share/icinga2-ido-mysql/schema/mysql.sql' + state: import + login_unix_socket: /var/run/mysqld/mysqld.sock + become: yes + when: ido_db.changed + +- name: IDO Database user + mysql_user: + name: icinga + host: 'localhost' + state: present + priv: 'ido.*:ALL' + password: '{{ icinga_ido_db_pw }}' + login_unix_socket: /var/run/mysqld/mysqld.sock + become: yes + +- name: Install extra config files + template: + src: '{{ item }}.j2' + dest: '/etc/icinga2/{{ item }}' + owner: nagios + group: nagios + become: yes + notify: Restart icinga + loop: + - ido-mysql.conf + - api_users.conf + +- name: Enable features + file: + state: link + path: '/etc/icinga2/features-available/api.con' + src: '../features-available/api.conf' + owner: nagios + group: nagios + become: yes + notify: Restart icinga |