From 0542253d4979c13ef958cc4d91c2943b928cf527 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 14 Feb 2025 02:07:58 +0400 Subject: [PATCH] Ignore errors for "install available update" Ansible task (#213) * Ignore errors for "install available update" Ansible task * Do not fail when update_result is not defined --- ansible/roles/system-updater/tasks/softwareupdate.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/roles/system-updater/tasks/softwareupdate.yml b/ansible/roles/system-updater/tasks/softwareupdate.yml index c9564fb..060f2e1 100644 --- a/ansible/roles/system-updater/tasks/softwareupdate.yml +++ b/ansible/roles/system-updater/tasks/softwareupdate.yml @@ -24,8 +24,10 @@ # > ssh: connect to host [...] port 22: Connection refused. ignore_unreachable: yes # Ignore SIGTERM/SIGKILL sent "softwareupdate" process - # when the system reboots due to --restart - failed_when: update_result.rc not in [0, 9, -9, 15, -15] + # when the system reboots due to --restart and any other errors, + # since we'll check whether the update was installed in main.yml + # anyway. + ignore_errors: yes become: yes loop: "{{ software_updates }}" when: "not item.label.startswith('macOS') or item.version.split('.')[0] == ansible_facts['distribution_version'].split('.')[0]" @@ -38,6 +40,4 @@ # the commands below on a non-restarted system. delay: 60 timeout: 1800 - when: - - update_result is defined - - not update_result.skipped + when: update_result is defined and not update_result.skipped | default(false)