# Override in secrets repo
nagios_allowed_hosts: "127.0.0.1"
+
+# Override in roles/common/vars/os_version.yml
+nrpe_selinux_packages:
+ - libsemanage-python
+ - policycoreutils-python
# configure nagios (Except OpenSUSE and RHEL8)
- import_tasks: nagios.yml
- when:
- - ansible_pkg_mgr != "zypper"
- - not (ansible_distribution == "RedHat" and ansible_distribution_major_version == "8")
+ when: ansible_pkg_mgr != "zypper"
tags:
- nagios
- name: Get SELinux status
command: getenforce
register: selinux_status
- when: ansible_pkg_mgr == "yum"
+ when: ansible_os_family == "RedHat"
tags:
- nagios
# configure selinux for nagios
- import_tasks: nrpe-selinux.yml
when: ansible_os_family == "RedHat" and
- ansible_distribution_major_version != "8" and
(selinux_status is defined and selinux_status.stdout != "Disabled")
tags:
- nagios
with_items: "{{ nrpe_packages }}"
when:
- ansible_os_family == "RedHat"
- - ansible_distribution_major_version|int <= 7
- have_epel.rc == 0
- name: Install nrpe package and dependencies (Ubuntu)
---
- name: nrpe - Install SELinux dependencies
- yum:
+ package:
name: "{{ item }}"
state: installed
- with_items:
- - libsemanage-python
- - policycoreutils-python
+ with_items: "{{ nrpe_selinux_packages }}"
# ignore_errors in case we don't have any repos
- name: nrpe - Ensure SELinux policy is up to date
- yum:
+ package:
name: selinux-policy-targeted
state: latest
ignore_errors: true
# create and manage epel.repo
- import_tasks: epel.yml
- when: (ansible_distribution == "CentOS" or ansible_distribution == 'RedHat') and ansible_distribution_major_version|int <= 7
+ when: (ansible_distribution == "CentOS" or ansible_distribution == 'RedHat')
tags:
- epel
- repos
--- /dev/null
+---
+epel_repos:
+ epel:
+ name: "Extra Packages for Enterprise Linux $releasever - $basearch"
+ metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
+ failovermethod: priority
+ # ternary requires ansible >= 1.9
+ enabled: "{{ enable_epel | ternary(1, 0) }}"
+ gpgcheck: 0
+
+nrpe_selinux_packages:
+ - python3-libsemanage
+ - python3-policycoreutils
rhsm_repos:
- rhel-8-for-x86_64-baseos-rpms
- rhel-8-for-x86_64-appstream-rpms
+
+epel_repos:
+ epel:
+ name: "Extra Packages for Enterprise Linux $releasever - $basearch"
+ metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
+ failovermethod: priority
+ # ternary requires ansible >= 1.9
+ enabled: "{{ enable_epel | ternary(1, 0) }}"
+ gpgcheck: 0
+
+nrpe_selinux_packages:
+ - python3-libsemanage
+ - python3-policycoreutils