diff --git a/library/centos/roles/basic-setup/defaults/main.yml b/library/centos/roles/basic-setup/defaults/main.yml index 18caf63c..11d1b873 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 8470a669..24318a99 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 }}'