]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
testnodes: configure selinux for nagios monitoring 212/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 16 Mar 2016 17:06:45 +0000 (13:06 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 16 Mar 2016 18:41:04 +0000 (14:41 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/testnode/files/nagios/nrpe.te [new file with mode: 0644]
roles/testnode/tasks/main.yml
roles/testnode/tasks/nrpe-selinux.yml [new file with mode: 0644]

diff --git a/roles/testnode/files/nagios/nrpe.te b/roles/testnode/files/nagios/nrpe.te
new file mode 100644 (file)
index 0000000..c7bc886
--- /dev/null
@@ -0,0 +1,12 @@
+module nrpe 1.0;
+
+require {
+       type fsadm_exec_t;
+       type nrpe_t;
+       type hwdata_t;
+       class file { read getattr open };
+}
+
+#============= nrpe_t ==============
+allow nrpe_t fsadm_exec_t:file getattr;
+allow nrpe_t hwdata_t:file { read getattr open };
index e06aba50d4815dc1517387fda254c8e3591f1f66..49f04c1e921603ca07d845dd3faccce8454bf6de 100644 (file)
   tags:
     - nagios
 
+# configure selinux for nagios
+- include: nrpe-selinux.yml
+  when: ansible_pkg_mgr == "yum"
+  tags:
+    - nagios
+
 # configure ntp
 - include: ntp.yml
   tags:
diff --git a/roles/testnode/tasks/nrpe-selinux.yml b/roles/testnode/tasks/nrpe-selinux.yml
new file mode 100644 (file)
index 0000000..2fd781a
--- /dev/null
@@ -0,0 +1,39 @@
+---
+- name: nrpe - Install semanage python bindings
+  yum:
+    pkg: libsemanage-python
+    state: installed
+
+- name: nrpe - Install SELinux tools
+  yum:
+    pkg: policycoreutils-python
+    state: installed
+
+- name: nrpe - Set SELinux boolean nagios_run_sudo true
+  seboolean:
+    name: nagios_run_sudo
+    state: yes
+    persistent: yes
+
+- name: nrpe - Remove SELinux policy package
+  command: semodule -r nrpe
+  failed_when: false
+
+- name: nrpe - Copy SELinux type enforcement file
+  copy:
+    src: nagios/nrpe.te
+    dest: /tmp/nrpe.te
+
+- name: nrpe - Compile SELinux module file
+  command: checkmodule -M -m -o /tmp/nrpe.mod /tmp/nrpe.te
+
+- name: nrpe - Build SELinux policy package
+  command: semodule_package -o /tmp/nrpe.pp -m /tmp/nrpe.mod
+
+- name: nrpe - Load SELinux policy package
+  command: semodule -i /tmp/nrpe.pp
+
+- name: nrpe - Remove temporary files
+  file:
+    path: /tmp/nrpe.*
+    state: absent