From: David Galloway Date: Thu, 26 Sep 2019 23:22:44 +0000 (-0400) Subject: common: Add EPEL8 support! X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50eddcfca72b450772ef1279a73528b6534715cb;p=ceph-cm-ansible.git common: Add EPEL8 support! Signed-off-by: David Galloway --- diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index d86f2e04..3f6b11dd 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -43,3 +43,8 @@ yum_timeout: 300 # 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 diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 494bedf8..3b620982 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -43,23 +43,20 @@ # 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 diff --git a/roles/common/tasks/nagios.yml b/roles/common/tasks/nagios.yml index e7a13e71..0528672d 100644 --- a/roles/common/tasks/nagios.yml +++ b/roles/common/tasks/nagios.yml @@ -39,7 +39,6 @@ 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) diff --git a/roles/common/tasks/nrpe-selinux.yml b/roles/common/tasks/nrpe-selinux.yml index e8f39268..62548d12 100644 --- a/roles/common/tasks/nrpe-selinux.yml +++ b/roles/common/tasks/nrpe-selinux.yml @@ -1,15 +1,13 @@ --- - 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 diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index 91bbf070..9318053d 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -72,7 +72,7 @@ # 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 diff --git a/roles/common/vars/centos_8.yml b/roles/common/vars/centos_8.yml new file mode 100644 index 00000000..746ed3eb --- /dev/null +++ b/roles/common/vars/centos_8.yml @@ -0,0 +1,13 @@ +--- +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 diff --git a/roles/common/vars/redhat_8.yml b/roles/common/vars/redhat_8.yml index db6f0b78..8d88ffeb 100644 --- a/roles/common/vars/redhat_8.yml +++ b/roles/common/vars/redhat_8.yml @@ -2,3 +2,16 @@ 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