From f193fa7aeeffa6d27a060051a59e0df83e8fa244 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 18 Oct 2020 18:33:57 +0200 Subject: [PATCH] Added support for specific update messages --- playbook/_common.sh | 18 ++++++++++++++++++ playbook/execute.sh | 19 +++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/playbook/_common.sh b/playbook/_common.sh index e628ba7..35c21ea 100644 --- a/playbook/_common.sh +++ b/playbook/_common.sh @@ -27,6 +27,24 @@ function setup_finished() { exit 0; } +function update_failed() { + cat </dev/null 2>&1 && pwd )"; source "$DIR/_common.sh"; +function is_update() { + return [ -d /playbook.old ]; +} + cd "$DIR"; echo "localhost ansible_connection=local" > hosts if ansible-playbook -i hosts site.yml; then - if [ ! -d /playbook.old ]; then + if is_update; then + update_finished; + exit 1; + else echo "Dieses Passwort wurde für das admin-Konto generiert:" echo "$(cat credentials/admin)"; ask_yes_no change_pass "Möchten Sie das Passwort ändern?"; if $change_pass; then retry_on_fail "Fehler bei der Passwortänderung, bitte versuchen sie es erneut!" passwd admin; fi + setup_finished; + exit 1; fi - setup_finished; - exit 1; fi -setup_failed; +if is_update; then + update_failed; +else + setup_failed; +fi exit 1;