[icinga-checkins] icinga.org: icinga2-ansible/master: Added support for Fedora 22/ 23 on no-ui/ web2ui - README Updated - Added task to restart Icinga2 - Fix variables name

git at icinga.org git at icinga.org
Sun Feb 21 15:30:38 CET 2016


Module: icinga2-ansible
Branch: master
Commit: 805c25dce9bc45ddc28d0c0c282b278bbd52d677
URL:    https://git.icinga.org/?p=icinga2-ansible.git;a=commit;h=805c25dce9bc45ddc28d0c0c282b278bbd52d677

Author: Valentino Gagliardi <valentino.g at servermanaged.it>
Date:   Sun Feb 21 15:30:20 2016 +0100

Added support for Fedora 22/23 on no-ui/web2ui - README Updated - Added task to restart Icinga2 - Fix variables name

---

 icinga2-ansible-no-ui/README.md                    |    4 +-
 icinga2-ansible-no-ui/defaults/main.yml            |    3 --
 icinga2-ansible-no-ui/meta/main.yml                |    3 ++
 .../tasks/icinga2_RedHat_install.yml               |   13 ++++---
 icinga2-ansible-web2-ui/README.md                  |   16 +++++---
 icinga2-ansible-web2-ui/defaults/main.yml          |    9 +++--
 icinga2-ansible-web2-ui/meta/main.yml              |    7 ++--
 .../tasks/icinga2_web2_ui_RedHat_install.yml       |   39 ++++++++++++++------
 .../tasks/icinga2_nrpe_agent_RedHat.yml            |    4 --
 9 files changed, 61 insertions(+), 37 deletions(-)

diff --git a/icinga2-ansible-no-ui/README.md b/icinga2-ansible-no-ui/README.md
index 734a616..14cad56 100644
--- a/icinga2-ansible-no-ui/README.md
+++ b/icinga2-ansible-no-ui/README.md
@@ -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
 -------------------------
diff --git a/icinga2-ansible-no-ui/defaults/main.yml b/icinga2-ansible-no-ui/defaults/main.yml
index f912a28..ca894e0 100644
--- a/icinga2-ansible-no-ui/defaults/main.yml
+++ b/icinga2-ansible-no-ui/defaults/main.yml
@@ -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"
diff --git a/icinga2-ansible-no-ui/meta/main.yml b/icinga2-ansible-no-ui/meta/main.yml
index 90a08d3..9bf0f6c 100644
--- a/icinga2-ansible-no-ui/meta/main.yml
+++ b/icinga2-ansible-no-ui/meta/main.yml
@@ -36,6 +36,9 @@ galaxy_info:
   #  - 18
   #  - 19
     - 20
+    - 21
+    - 22
+    - 23
   #- name: opensuse
   #  versions:
   #  - all
diff --git a/icinga2-ansible-no-ui/tasks/icinga2_RedHat_install.yml b/icinga2-ansible-no-ui/tasks/icinga2_RedHat_install.yml
index 9509cbe..8999846 100644
--- a/icinga2-ansible-no-ui/tasks/icinga2_RedHat_install.yml
+++ b/icinga2-ansible-no-ui/tasks/icinga2_RedHat_install.yml
@@ -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
@@ -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
diff --git a/icinga2-ansible-web2-ui/README.md b/icinga2-ansible-web2-ui/README.md
index d7f2329..d73c544 100644
--- a/icinga2-ansible-web2-ui/README.md
+++ b/icinga2-ansible-web2-ui/README.md
@@ -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
 ------------
@@ -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
 
diff --git a/icinga2-ansible-web2-ui/defaults/main.yml b/icinga2-ansible-web2-ui/defaults/main.yml
index caa4bc0..cf3786c 100644
--- a/icinga2-ansible-web2-ui/defaults/main.yml
+++ b/icinga2-ansible-web2-ui/defaults/main.yml
@@ -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"
diff --git a/icinga2-ansible-web2-ui/meta/main.yml b/icinga2-ansible-web2-ui/meta/main.yml
index 7d3214e..7c01973 100644
--- a/icinga2-ansible-web2-ui/meta/main.yml
+++ b/icinga2-ansible-web2-ui/meta/main.yml
@@ -31,8 +31,8 @@ galaxy_info:
   #  versions:
   #  - all
   #  - any
-  #- name: Fedora
-  #  versions:
+  - name: Fedora
+    versions:
   #  - all
   #  - 16
   #  - 17
@@ -40,7 +40,8 @@ galaxy_info:
   #  - 19
   #  - 20
   #  - 21
-  #  - 22
+    - 22
+    - 23
   #- name: Windows
   #  versions:
   #  - all
diff --git a/icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_RedHat_install.yml b/icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_RedHat_install.yml
index dd92d0a..78ea7ff 100644
--- a/icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_RedHat_install.yml
+++ b/icinga2-ansible-web2-ui/tasks/icinga2_web2_ui_RedHat_install.yml
@@ -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
@@ -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"
diff --git a/icinga2-nrpe-agent/tasks/icinga2_nrpe_agent_RedHat.yml b/icinga2-nrpe-agent/tasks/icinga2_nrpe_agent_RedHat.yml
index 5b91c58..de6211f 100644
--- a/icinga2-nrpe-agent/tasks/icinga2_nrpe_agent_RedHat.yml
+++ b/icinga2-nrpe-agent/tasks/icinga2_nrpe_agent_RedHat.yml
@@ -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
@@ -15,5 +13,3 @@
             backup=yes
   notify:
    - restart nrpe
-  tags:
-   - nrpe_agent_config



More information about the icinga-checkins mailing list