]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
common: Enable nrpe installation without epel repo on RHEL/CentOS
authorDavid Galloway <dgallowa@redhat.com>
Tue, 12 Jul 2016 19:09:40 +0000 (15:09 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 13 Jul 2016 03:39:23 +0000 (23:39 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/common/tasks/nagios.yml

index 7d83766f9edbeefa904349358a077dc822aa2d31..76f5ad53066508b60692ca3234c697b71e6f7753 100644 (file)
@@ -7,6 +7,26 @@
   include_vars: yum_systems.yml
   when: ansible_pkg_mgr == "yum"
 
+# Returns 0 if found and 1 if not found
+# Task fails if not found.  Hence ignore_errors: true
+- name: Check for epel
+  shell: "grep -q 'epel' /etc/yum.repos.d/*"
+  register: have_epel
+  no_log: true
+  ignore_errors: true
+  when: ansible_pkg_mgr == "yum"
+
+# This task is only run when epel isn't present
+- name: Install nrpe without epel
+  yum:
+    name: "{{ item }}"
+    state: present
+  with_items:
+    - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nagios-common-4.0.8-2.el7.x86_64.rpm
+    - http://{{ mirror_host }}/lab-extras/rhel7/x86_64/nrpe-2.15-7.el7.x86_64.rpm
+  when: ansible_pkg_mgr == "yum" and
+        have_epel.rc == 1
+
 - name: Install nrpe package and dependencies (RHEL/CentOS)
   yum:
     name: "{{ item }}"
@@ -15,7 +35,8 @@
   with_items:
     - nrpe
     - smartmontools
-  when: ansible_pkg_mgr == "yum"
+  when: ansible_pkg_mgr == "yum" and
+        have_epel.rc == 0
 
 - name: Install nrpe package and dependencies (Ubuntu)
   apt: