Skip to content

Commit

Permalink
Added support for Fedora 22/23 on no-ui/web2ui - README Updated - Add…
Browse files Browse the repository at this point in the history
…ed task to restart Icinga2 - Fix variables name
  • Loading branch information
valentinogagliardi committed Feb 21, 2016
1 parent 3843690 commit 805c25d
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 37 deletions.
4 changes: 3 additions & 1 deletion icinga2-ansible-no-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Ansible role to install Icinga2 Headless alongside Plugins
Requirements
------------

EPEL
On CentOS/RH: EPEL

On Fedora from version 22: `python-dnf`

Example Playbook
-------------------------
Expand Down
3 changes: 0 additions & 3 deletions icinga2-ansible-no-ui/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ icinga2_pkg:
- { package: "icinga2" }
- { package: "nagios-plugins" }

req_pkg:
- { package: "gpg" }

icinga2_url_yum: "http://packages.icinga.org/epel/ICINGA-release.repo"
icinga2_url_yum_fedora: "http://packages.icinga.org/fedora/ICINGA-release.repo"
icinga2_repo_yum: "/etc/yum.repos.d/ICINGA-release.repo"
Expand Down
3 changes: 3 additions & 0 deletions icinga2-ansible-no-ui/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ galaxy_info:
# - 18
# - 19
- 20
- 21
- 22
- 23
#- name: opensuse
# versions:
# - all
Expand Down
13 changes: 7 additions & 6 deletions icinga2-ansible-no-ui/tasks/icinga2_RedHat_install.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
---
- name: Install Requirements on RedHat OS family (Fedora)
yum: name={{ item.package }}
state=latest
with_items: req_pkg
when: ansible_distribution == 'Fedora'

- name: Get Icinga2 Yum Key on RedHat OS family
rpm_key: key={{ icinga2_key }}
state=present
Expand All @@ -22,6 +16,13 @@
yum: name={{ item.package }}
state=latest
with_items: icinga2_yum
when: ansible_pkg_mgr == "yum"

- name: Install Icinga2 on RedHat OS family (Fedora > 22)
dnf: name={{ item.package }}
state=latest
with_items: icinga2_yum
when: ansible_pkg_mgr == "dnf"

- name: Start Icinga2
service: name=icinga2
Expand Down
16 changes: 11 additions & 5 deletions icinga2-ansible-web2-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ Ansible role to install Icinga2 Web2 Ui
Requirements
------------

Mysql or MariaDB - Httpd or Nginx - PHP
On CentOS/RH: EPEL

On Fedora from version 22: `python-dnf`

Mysql or MariaDB - Httpd

PHP (is going to be installed as a dependency of icingaweb2)

Dependencies
------------
Expand Down Expand Up @@ -36,15 +42,15 @@ Example Playbook
tags: icinga2-no-ui

- role: icinga2-ansible-web2-ui
icinga2_web2_db_pass: "CHANGEME"
icinga2_db_pass: "CHANGEME"
icinga2_ido_mysql_configuration: |
library "db_ido_mysql"
object IdoMysqlConnection "ido-mysql" {
user = "{{ icinga2_web2_db_user }}"
password = "{{ icinga2_web2_db_pass }}"
user = "{{ icinga2_db_user }}"
password = "{{ icinga2_db_pass }}"
host = "localhost"
database = "{{ icinga2_web2_db }}"
database = "{{ icinga2_db }}"
}
tags: icinga2-ansible-web2-ui

Expand Down
9 changes: 5 additions & 4 deletions icinga2-ansible-web2-ui/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
# defaults file for icinga2-ansible-web2-ui

icinga2_web2_db: "icinga"
icinga2_web2_db_pass: "icinga"
icinga2_web2_db_user: "icinga"
icinga2_web_mysql_schema_rh_6: "/usr/share/icinga2-ido-mysql/schema/mysql.sql"
icinga2_db: "icinga"
icinga2_db_pass: "icinga"
icinga2_db_user: "icinga"
icinga2_mysql_schema_rh: "/usr/share/icinga2-ido-mysql/schema/mysql.sql"

icinga2_ido_mysql_conf: "/etc/icinga2/features-available/ido-mysql.conf"
icinga2_ido_mysql_configuration: "none"
enablerepo: "base"
Expand Down
7 changes: 4 additions & 3 deletions icinga2-ansible-web2-ui/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ galaxy_info:
# versions:
# - all
# - any
#- name: Fedora
# versions:
- name: Fedora
versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
- 22
- 23
#- name: Windows
# versions:
# - all
Expand Down
39 changes: 28 additions & 11 deletions icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_RedHat_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@
- name: Install Icinga2 IDO modules on RedHat OS family
yum: name=icinga2-ido-mysql
state=latest
when: ansible_pkg_mgr == "yum"

- name: Install Icinga2 IDO modules on RedHat OS family (Fedora > 22)
dnf: name=icinga2-ido-mysql
state=latest
when: ansible_pkg_mgr == "dnf"

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

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

- name: Import the IDO Schema on Icinga Web Database - RH6 (only once)
mysql_db: name={{ icinga2_web2_db }}
- name: Import the IDO Schema on Icinga Web Database (only once)
mysql_db: name={{ icinga2_db }}
state=import
target={{ icinga2_web_mysql_schema_rh_6 }}
when: ansible_distribution_major_version == "6" and icinga_web2_db.changed == true
target={{ icinga2_web_mysql_schema_rh }}
when: icinga_web2_db.changed == true

- name: Configure Icinga2 Ido Mysql Feature
template: src=ido-mysql.conf.j2
Expand All @@ -41,12 +47,23 @@
enablerepo={{ enablerepo }}
with_items: icinga2_web2_ui_rpm
tags: icinga2-ansible-web2-ui-install
when: ansible_pkg_mgr == "yum"

- name: Install Icinga Web2 on RedHat OS family
dnf: name={{ item.package }}
state=latest
enablerepo={{ enablerepo }}
with_items: icinga2_web2_ui_rpm
tags: icinga2-ansible-web2-ui-install
when: ansible_pkg_mgr == "dnf"

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

- 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"
Expand Down
4 changes: 0 additions & 4 deletions icinga2-nrpe-agent/tasks/icinga2_nrpe_agent_RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
yum: name={{ item.package }}
state=latest
with_items: nrpe_agent_{{ ansible_os_family }}
tags:
- nrpe_agent_install

- name: Copy Nrpe Configuration
template: src=nrpe.cfg.j2
Expand All @@ -15,5 +13,3 @@
backup=yes
notify:
- restart nrpe
tags:
- nrpe_agent_config

0 comments on commit 805c25d

Please sign in to comment.