Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions icinga2-ansible-web2-ui/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
---
# defaults file for icinga2-ansible-web2-ui

icinga2_web2_db: "icinga"
icinga2_web2_db_pass: "icinga"
icinga2_web2_db_user: "icinga"
icinga2_web2_db: "icingaweb2"
icinga2_web2_db_pass: "icingaweb2"
icinga2_web2_db_user: "icingaweb2"

icinga2_web2_ido_db: "icingaweb2ido"
icinga2_web2_ido_db_pass: "icingaweb2ido"
icinga2_web2_ido_db_user: "icingaweb2ido"

icinga2_web_mysql_schema_ido_debian: "/usr/share/icinga2-ido-mysql/schema/mysql.sql"
icinga2_ido_mysql_conf: "/etc/icinga2/features-available/ido-mysql.conf"

icinga2_web_mysql_schema_rh_6: "/usr/share/icinga2-ido-mysql/schema/mysql.sql"
icinga2_ido_mysql_conf: "/etc/icinga2/features-available/ido-mysql.conf"
icinga2_ido_mysql_configuration: "none"
Expand All @@ -12,3 +20,6 @@ enablerepo: "base"
icinga2_web2_ui_rpm:
- { package: "icingaweb2" }
- { package: "icingacli" }

icinga2_web2_ui_deb:
- { package: "icingaweb2" }
62 changes: 62 additions & 0 deletions icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_Debian_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
- name: Install Icinga Web2 on Debian OS family
apt: name={{ item }}
state=latest
with_items:
- icingaweb2
- icinga2-ido-mysql
tags: icinga2-ansible-web2-ui-debian-install

- name: Create a Database for Icinga2
mysql_db: name={{ icinga2_web2_db }}
state=present
register: icinga_web2_db

- name: Create a Database for Icinga2 IDO
mysql_db: name={{ icinga2_web2_ido_db }}
state=present
register: icinga_web2_ido_db

- name: Create Icinga Database User and configure Grants
mysql_user: name={{ icinga2_web2_db_user }}
password={{ icinga2_web2_db_pass }}
state=present
priv="{{ icinga2_web2_db }}.*:ALL"

- name: Create Icinga Database IDO User and configure Grants
mysql_user: name={{ icinga2_web2_ido_db_user }}
password={{ icinga2_web2_ido_db_pass }}
state=present
priv="{{ icinga2_web2_ido_db }}.*:ALL"

- name: Import the IDO Schema on Icinga Web Database
mysql_db: name={{ icinga2_web2_ido_db }}
state=import
target={{ icinga2_web_mysql_schema_ido_debian }}
when: icinga_web2_ido_db.changed == true

- name: Configure Icinga2 Ido Mysql Feature
template: src=ido-mysql-debian.conf.j2
dest={{ icinga2_ido_mysql_conf }}
backup=yes
owner=nagios
group=nagios
mode=0640

- name: Enable Icinga2 Ido Mysql Feature
command: "icinga2 feature enable ido-mysql"
register: features_result
changed_when: "'for these changes to take effect' in features_result.stdout"
notify:
- restart icinga2

- name: Get token Installation
command: icingacli setup token create
register: token

- name: Print token
debug: msg="{{ token.stdout }}"

- name: Icinga Web2 Installation finished (RH)
debug: msg="Now generate a token with 'icingacli setup token create' and go at http://IP/icingaweb2/setup to continue the installation"
tags: icinga2-ansible-web2-ui-install
3 changes: 3 additions & 0 deletions icinga2-ansible-web2-ui/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

- include: icinga2_web2_ui_RedHat_install.yml
when: ansible_os_family == 'RedHat'

- include: icinga2_web2_ui_Debian_install.yml
when: ansible_os_family == 'Debian'
15 changes: 15 additions & 0 deletions icinga2-ansible-web2-ui/templates/ido-mysql-debian.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# {{ ansible_managed }}

/**
* The db_ido_mysql library implements IDO functionality
* for MySQL.
*/

library "db_ido_mysql"

object IdoMysqlConnection "ido-mysql" {
user = "{{ icinga2_web2_ido_db_user }}",
password = "{{ icinga2_web2_ido_db_pass }}",
host = "localhost",
database = "{{ icinga2_web2_ido_db }}"
}