git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/patch.yml
diff options
context:
space:
mode:
Diffstat (limited to 'patch.yml')
-rw-r--r--patch.yml31
1 files changed, 28 insertions, 3 deletions
diff --git a/patch.yml b/patch.yml
index b7fcf5a..92f86b2 100644
--- a/patch.yml
+++ b/patch.yml
@@ -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"