From 815e1bcda1b1edbf09b66b59e4ea7e0ea013c1d9 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 1 Aug 2021 13:35:08 -0500 Subject: [PATCH] Add full-blown unreachability checking --- .gitlab-ci.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e0d0c5..a751f54 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,23 +48,28 @@ Lint: - ansible-lint site.yml Test: - allow_failure: yes interruptible: yes stage: test script: - ansible-playbook --skip-tags no-test -C site.yml --vault-password-file /vaultpw || error="$?" + - [ "$error" -eq 4 ] && echo "Some hosts were unreachable; masking error" && unset error - [ -n "$error" ] && echo "Return code $error" && false Play_Against_Pis: stage: play script: - - ansible-playbook -l pis site.yml --vault-password-file /vaultpw + - ansible-playbook -l pis site.yml --vault-password-file /vaultpw || error="$?" + - [ "$error" -eq 4 ] && echo "Some hosts were unreachable; masking error" && unset error + - [ -n "$error" ] && echo "Return code $error" && false Play_Against_Desktops: stage: play script: - ansible-playbook -l desktop site.yml --vault-password-file /vaultpw || error="$?" + - [ "$error" -eq 4 ] && echo "Some hosts were unreachable; masking error" && unset error - [ -n "$error" ] && echo "Return code $error" && false Play_Against_Production: stage: play script: - - ansible-playbook -l prod site.yml --vault-password-file /vaultpw + - ansible-playbook -l prod site.yml --vault-password-file /vaultpw || error="$?" + - [ "$error" -eq 4 ] && echo "Some hosts were unreachable; masking error" && unset error + - [ -n "$error" ] && echo "Return code $error" && false