From d13a91f32923473319a2235c4ce3887e32bb4ea4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 3 Dec 2021 13:17:39 +0100 Subject: [PATCH] Other EL 7 vs 8 pkg names differences. --- .../centos/roles/basic-setup/defaults/main.yml | 5 ++++- .../centos/roles/basic-setup/tasks/main.yml | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/library/centos/roles/basic-setup/defaults/main.yml b/library/centos/roles/basic-setup/defaults/main.yml index 18caf63..11d1b87 100644 --- a/library/centos/roles/basic-setup/defaults/main.yml +++ b/library/centos/roles/basic-setup/defaults/main.yml @@ -18,6 +18,10 @@ el_dnf_automation: False centos8_packages_automation: - dnf-automatic +centos7_packages_to_install: + - policycoreutils-python +centos8_packages_to_install: + - policycoreutils-python-utils centos_packages_to_install: - dstat - lsof @@ -26,7 +30,6 @@ centos_packages_to_install: - bind-utils - whois - iotop - - policycoreutils-python - firewalld - ipset - psmisc diff --git a/library/centos/roles/basic-setup/tasks/main.yml b/library/centos/roles/basic-setup/tasks/main.yml index 8470a66..24318a9 100644 --- a/library/centos/roles/basic-setup/tasks/main.yml +++ b/library/centos/roles/basic-setup/tasks/main.yml @@ -1,8 +1,24 @@ --- -- name: Install the basic packages +- name: Install the basic packages commont to CentOS 7 and 8+ yum: name={{ centos_packages_to_install }} state={{ centos_pkg_state }} tags: [ 'centos', 'bootstrap', 'packages' ] +- name: Install CentOS 7 packages + yum: + pkg: '{{ centos7_packages_to_install }}' + state: present + when: + - ansible_distribution_file_variety == "RedHat" + - ansible_distribution_major_version is version_compare('7', '<=') + +- name: Install CentOS 8 packages + dnf: + pkg: '{{ centos8_packages_to_install }}' + state: present + when: + - ansible_distribution_file_variety == "RedHat" + - ansible_distribution_major_version is version_compare('8', '>=') + - name: Install the packages to automate some yum tasks on CentOS 7 yum: pkg: '{{ centos7_packages_automation }}'