Skip to content
Merged
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
4 changes: 2 additions & 2 deletions icinga2-ansible-no-ui/tasks/icinga2_Debian_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
apt_repository: repo='{{ item.repo }}'
update_cache=yes
state=present
with_items: icinga2_deb_repos
with_items: '{{ icinga2_deb_repos }}'

#Debian packages require additional packages which are provided by the Debian Monitoring Project repository
- name: Get Debmon Apt Repo for Debian OS family (Debian)
Expand All @@ -27,7 +27,7 @@
update_cache=yes
state=latest
install_recommends=no
with_items: icinga2_pkg
with_items: '{{ icinga2_pkg }}'

- name: Start Icinga2
service: name=icinga2
Expand Down
6 changes: 5 additions & 1 deletion icinga2-ansible-web2-ui/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ icinga2_db: "icinga"
icinga2_db_pass: "icinga"
icinga2_db_user: "icinga"
icinga2_web_mysql_schema_rh: "/usr/share/icinga2-ido-mysql/schema/mysql.sql"
icinga2_web_mysql_schema_debian: "/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 @@ -13,10 +14,13 @@ icinga2_web2_db: "icingaweb"
icinga2_web2_db_pass: "icingaweb"
icinga2_web2_db_user: "icingaweb"
icinga2_web2_mysql_schema_rh: "/usr/share/doc/icingaweb2/schema/mysql.schema.sql"

icinga2_web2_mysql_schema_debian: "/usr/share/icingaweb2/etc/schema/mysql.schema.sql"

enablerepo: "base"

icinga2_web2_ui_rpm:
- { package: "icingaweb2" }
- { package: "icingacli" }

icinga2_web2_ui_deb:
- { package: "icingaweb2" }
96 changes: 96 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,96 @@
---
- name: Install Icinga2 IDO modules on Debian family
apt: name=icinga2-ido-mysql
state=latest

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

- name: Create Icinga2 IDO Database User and configure Grants
mysql_user: name={{ icinga2_db_user }}
password={{ icinga2_db_pass }}
state=present
priv="{{ icinga2_db }}.*:GRANT,INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"

- name: Import the IDO Schema on Icinga Web Database (only once)
mysql_db: name={{ icinga2_db }}
state=import
target={{ icinga2_web_mysql_schema_debian }}
when: icinga_ido_db.changed == true

- name: Configure Icinga2 Ido Mysql Feature
template: src=ido-mysql.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: Install Icinga Web2 on Debian family
apt: name={{ item.package }}
state=latest
with_items: '{{ icinga2_web2_ui_deb }}'
tags: icinga2-ansible-web2-ui-install

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

- name: Create Icinga2 Web Database User and configure Grants
mysql_user: name={{ icinga2_web2_db_user }}
password={{ icinga2_web2_db_pass }}
state=present
priv="{{ icinga2_web2_db }}.*:GRANT,INSERT,SELECT,UPDATE,DELETE,DROP,CREATE VIEW,INDEX,EXECUTE"

- name: Import the Web Schema on Icinga Web Database (only once)
mysql_db: name={{ icinga2_web2_db }}
state=import
target={{ icinga2_web2_mysql_schema_debian }}
when: icinga_web_db.changed == true

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

- name: Restart HTTPD and Icinga2 to Apply the Configuration
service: name={{ item }}
state=restarted
enabled=yes
with_items:
- apache2
- icinga2

- name: Add user www-data to group icingaweb2
user: name=www-data
groups=icingaweb2

- name: Adjust Directory Owener and Group
file: path=/etc/icingaweb2/modules owner=www-data group=icingaweb2 mode=0755
state=directory
recurse=yes

- name: Create Directory Owener and Group
file: path=/etc/icingaweb2/modules/{{ item }} owner=www-data group=icingaweb2 mode=0755
state=directory
with_items:
- monitoring
- translation

- name: Icinga Web2 Installation finished (Debian)
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'