From 867482d35ba2ba08ca944fcb088ff29f8969266a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 14 Sep 2021 13:20:17 -0600 Subject: [PATCH] replace ini_file with yum/dnf For ansible-core 2.11 compatability, replace the use of `ini_file` with the yum/dnf config-manager command Signed-off-by: Rich Megginson --- tests/tasks/enable_epel.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/tasks/enable_epel.yml b/tests/tasks/enable_epel.yml index c63d382..e5e54ba 100644 --- a/tests/tasks/enable_epel.yml +++ b/tests/tasks/enable_epel.yml @@ -8,20 +8,17 @@ warn: false creates: /etc/yum.repos.d/epel.repo - - name: Retrieve EPEL {{ ansible_distribution_major_version }} file stats - stat: - path: /etc/yum.repos.d/epel.repo - register: _result + - name: Enable EPEL 7 + command: yum config-manager --set-enabled epel + when: ansible_distribution_major_version == '7' + args: + warn: false - - name: Enable EPEL {{ ansible_distribution_major_version }} - ini_file: - path: /etc/yum.repos.d/epel.repo - section: epel - mode: "{{ _result.stat.mode }}" - owner: "{{ _result.stat.pw_name }}" - group: "{{ _result.stat.gr_name }}" - option: enabled - value: "1" + - name: Enable EPEL 8 + command: dnf config-manager --set-enabled epel + when: ansible_distribution_major_version == '8' + args: + warn: false when: - ansible_distribution in ['RedHat', 'CentOS'] - ansible_distribution_major_version in ['7', '8']