From beb15278991b99ca26dd464d639b6d165fcfec6d Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 28 Sep 2022 12:40:09 +0200 Subject: [PATCH] added server ansible update if available /root/server-$(hostname -s)/$(hostname -s).sh --- autoupdate.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autoupdate.yml b/autoupdate.yml index fb217b6..9ce9fd5 100644 --- a/autoupdate.yml +++ b/autoupdate.yml @@ -61,6 +61,21 @@ backup: yes validate: /bin/bash -n %s + - name: /usr/local/sbin/autoupdate.d/server.update + blockinfile: + path: /usr/local/sbin/autoupdate.d/server.update + mode: "0400" + owner: root + group: root + create: yes + marker: "# {mark} ANSIBLE MANAGED BLOCK" + block: | + [ -e /root/server-$(hostname -s)/$(hostname -s).sh ] && bash -ex /root/server-$(hostname -s)/$(hostname -s).sh >/var/log/server-$(hostname -s)-update.log 2>&1 + g_echo_warn "$(egrep -B1 "^changed" /var/log/server-$(hostname -s)-update.log)" + g_echo_error "$(egrep -q -B1 -i "^error|^failed" /var/log/server-$(hostname -s)-update.log && cat /var/log/server-$(hostname -s)-update.log)" + backup: yes + validate: /bin/bash -n %s + - name: /etc/cron.d/autoupdate_local blockinfile: path: /etc/cron.d/autoupdate_local