From 1770ba5e9d47aebdb9afa8892fb85fe6bcbed187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <Joerg.Sachse@slub-dresden.de> Date: Tue, 22 Feb 2022 15:02:49 +0100 Subject: [PATCH] fix: check for command return codes to control behaviour --- tasks/remove_packages.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/remove_packages.yml b/tasks/remove_packages.yml index 6984850..2de71d4 100644 --- a/tasks/remove_packages.yml +++ b/tasks/remove_packages.yml @@ -6,6 +6,12 @@ #command: systemctl list-unit-files | grep clam command: systemctl list-unit-files clamav-daemon.service clamav-freshclam.service register: check_clamav_installed + failed_when: + - ( "0 unit files listed." not in check_clamav_installed.stdout ) + - ( check_clamav_installed.rc != 0 ) + changed_when: + - ( "0 unit files listed." not in check_clamav_installed.stdout ) + - ( check_clamav_installed.rc != 0 ) - name: clamav Deinstallation block: - name: clamav systemd Services deaktivieren @@ -27,4 +33,4 @@ purge: true autoremove: yes when: - - ( "0 unit files listed." not in check_clamav_installed.stdout ) \ No newline at end of file + - ( "0 unit files listed." not in check_clamav_installed.stdout ) -- GitLab