From 71387ae7f1b349d9df1a79cb40e261d2e456a307 Mon Sep 17 00:00:00 2001 From: mcnesium Date: Wed, 11 Jan 2023 18:35:00 +0100 Subject: [PATCH 1/2] nocows and stuff --- ansible.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ansible.cfg b/ansible.cfg index 360ce153c..0c1d3df0f 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,6 +1,9 @@ [defaults] retry_files_enabled = False stdout_callback = yaml +display_failed_stderr = True +display_skipped_hosts = False +nocows = True [connection] pipelining = True From 1ae7d47e506dbf4c9c247bd70c6b9a678c911a9d Mon Sep 17 00:00:00 2001 From: mcnesium Date: Wed, 11 Jan 2023 18:57:16 +0100 Subject: [PATCH 2/2] add inventory/scripts/update.sh --- inventory/scripts/update.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 inventory/scripts/update.sh diff --git a/inventory/scripts/update.sh b/inventory/scripts/update.sh new file mode 100755 index 000000000..8a091bf10 --- /dev/null +++ b/inventory/scripts/update.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# +# Wrapper script for the entire update procedure including +# * updating git repo +# * downloading roles +# * running playbook +# +# This script first asks for the passwords for all the hosts and then pipes them +# to the ansible playbook wrapper script, so that we don't need to wait for the +# merging and downloading to finish, before being asked for the passwords. +# + +# exit on errors +set -e + +# set playbook root path +root=$(dirname "$(readlink -f "$0")")/../.. + +# capture passwords for all hosts +for host in "$root"/inventory/*.yml; do + read -rp "sudo password for $(basename "$host"): " -s pw + pipeinput+="$pw\n" + echo +done + +# merge upstream master branch +git -C "$root" pull upstream master + +# check the changelog before updating +less CHANGELOG.md +read -r + +# download upstream roles +make -f "$root"/Makefile roles + +# run ansible-playbook on all hosts +echo -e "$pipeinput" | bash "$root"/inventory/scripts/ansible-all-hosts.sh