From 4d0b9440c68eb562f2a7e592741b4e21d123cbb4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 3 Dec 2021 13:13:28 +0100 Subject: [PATCH] Centos 7 vs 8. --- .../centos/roles/basic-setup/defaults/main.yml | 11 +++++++++-- .../centos/roles/basic-setup/tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/library/centos/roles/basic-setup/defaults/main.yml b/library/centos/roles/basic-setup/defaults/main.yml index 934bdee..18caf63 100644 --- a/library/centos/roles/basic-setup/defaults/main.yml +++ b/library/centos/roles/basic-setup/defaults/main.yml @@ -9,14 +9,21 @@ dns1: 208.67.220.220 dns2: 208.67.222.222 configure_domain_name_in_interface: False +el_yum_automation: True +centos7_packages_automation: + - yum-cron + - yum-plugin-fastestmirror + +el_dnf_automation: False +centos8_packages_automation: + - dnf-automatic + centos_packages_to_install: - dstat - lsof - strace - traceroute - bind-utils - - yum-cron - - yum-plugin-fastestmirror - whois - iotop - policycoreutils-python diff --git a/library/centos/roles/basic-setup/tasks/main.yml b/library/centos/roles/basic-setup/tasks/main.yml index 8b4a35d..8470a66 100644 --- a/library/centos/roles/basic-setup/tasks/main.yml +++ b/library/centos/roles/basic-setup/tasks/main.yml @@ -3,6 +3,24 @@ yum: name={{ centos_packages_to_install }} state={{ centos_pkg_state }} tags: [ 'centos', 'bootstrap', 'packages' ] +- name: Install the packages to automate some yum tasks on CentOS 7 + yum: + pkg: '{{ centos7_packages_automation }}' + state: present + when: + - ansible_distribution_file_variety == "RedHat" + - ansible_distribution_major_version is version_compare('7', '<=') + - el_yum_automation + +- name: Install the packages to automate some dnf tasks on CentOS 8 + yum: + pkg: '{{ centos8_packages_automation }}' + state: present + when: + - ansible_distribution_file_variety == "RedHat" + - ansible_distribution_major_version is version_compare('8', '>=') + - el_dnf_automation + - name: Install the basic packages from the EPEL repository yum: name={{ centos_packages_from_epel }} state={{ centos_pkg_state }} when: centos_install_epel