diff options
author | mail_redacted_for_web | 2021-12-06 11:53:40 +0100 |
---|---|---|
committer | mail_redacted_for_web | 2021-12-06 11:53:40 +0100 |
commit | 43ee3b0bfe1b811403a2322289c8f1fa953bbb30 (patch) | |
tree | c3cece3a55541cf12e5e4cc0ce1410d7eba5e6b3 /patch.yml | |
parent | 037f24d9e070bc6ef4b77038fc6ec148b944c4c9 (diff) | |
download | ansible-43ee3b0bfe1b811403a2322289c8f1fa953bbb30.tar.bz2 |
%suse
Diffstat (limited to 'patch.yml')
-rw-r--r-- | patch.yml | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -163,6 +163,24 @@ zypper refs && zypper ref become: true listen: "suse upd" + - name: Verify Zypper repository availability + # Now, here's the thing with zypper. If you have a dead repository, you need to face the following facts: + # 1. All output goes to stdout. For zypper lu at least on SLE12/openSUSE42 and earlier, this is: + # - The packages available for update + # - Debug output lik "loading repository data..." and "reading installed packages..." + # (could be silenced with -q, but without RC feedback we need the debug strings again, kek.) + # - WARNING(!!) messages + # ... there is no STDERR. + # 2. There is no return code other than 0 for warnings. + # Great. Interaction with automatisms as if that stuff came directly from Redmond. + # So we need to parse the fucking output string in ansible. Let's start with the "repository not available" warnings. + debug: + msg: "Dead repositories existing and no update present, we consider this a failure." + when: + - zypperlu is search("Repository.*appears to be outdated") + - zypperlu is search("No updates found") + listen: "zypperlu" + failed_when: true - name: Update all packages (SUSE) # we could narrow this down via type:patch, but that's about all. So fire away. zypper: @@ -170,11 +188,18 @@ state: latest become: true # TODO: suse not productive yet, so we choose an arbitrary listener here. Change to something meaningful when going to production. - listen: "bonkadonk" + listen: "suse upd" - name: Register requirement for reboot (SUSE) - shell: zypper ps -sss + # change in paradigm: we will now use "needs-rebooting", suse implemented that somewhere between 12 and 15, instead of "ps -sss" + # shell: zypper ps -sss + # todo: what to do if services require a refork? + # shell: zypper ps -sss + shell: zypper needs-rebooting + args: + warn: false register: zyppout - changed_when: "zyppout.rc == 102" + changed_when: zyppout.rc == 102 + failed_when: zyppout.rc != 102 and zyppout.rc != 0 notify: "Reboot if required" # we listen to "suse upd" here in case a previous reboot was skipped. Change to "suse updates available" if undesired. listen: "suse upd" |