Skip to content

Commit

Permalink
Ignore errors for "install available update" Ansible task (#213)
Browse files Browse the repository at this point in the history
* Ignore errors for "install available update" Ansible task

* Do not fail when update_result is not defined
  • Loading branch information
edigaryev authored Feb 13, 2025
1 parent cdc53f0 commit 0542253
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ansible/roles/system-updater/tasks/softwareupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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)

0 comments on commit 0542253

Please sign in to comment.