From b41c938919a749c9adcdeba6b29f552ae6cca531 Mon Sep 17 00:00:00 2001 From: Albert van der Land Date: Thu, 28 Sep 2023 10:32:08 +0200 Subject: [PATCH] fix: dont use Yum/Rpm task when packages are already installed Signed-off-by: Albert van der Land --- roles/node_exporter/tasks/selinux.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/node_exporter/tasks/selinux.yml b/roles/node_exporter/tasks/selinux.yml index 754cbd0a2..b36656329 100644 --- a/roles/node_exporter/tasks/selinux.yml +++ b/roles/node_exporter/tasks/selinux.yml @@ -9,7 +9,10 @@ until: _install_selinux_packages is success retries: 5 delay: 2 - when: ansible_os_family | lower == "redhat" + when: + - ansible_os_family | lower == "redhat" + - "(('libselinux-python' not in ansible_facts.packages) and ('python3-libselinux' not in ansible_facts.packages)) or + (('policycoreutils-python' not in ansible_facts.packages) and ('python3-policycoreutils' not in ansible_facts.packages))" - name: Install selinux python packages [clearlinux] ansible.builtin.package: