From 9d9d4fdc70ec0ac276f3795f5ccea39d6b94b995 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 23 Apr 2020 04:59:13 +0200 Subject: further cleanup host bootstraping --- common/utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/utils.sh') diff --git a/common/utils.sh b/common/utils.sh index 262926c7..bb14381e 100644 --- a/common/utils.sh +++ b/common/utils.sh @@ -19,8 +19,8 @@ ansible_variable__get() { local _var_name="$1" local _hosts="$2" - local _result=$(env ANSIBLE_STDOUT_CALLBACK="json" ansible "$_hosts" -m debug -a "var=$_var_name" | \ - jq -r ".plays[].tasks[].hosts[].$_var_name" | sort | uniq) + local _result=$(env ANSIBLE_STDOUT_CALLBACK="json" ansible "$_hosts" -m debug -a "msg={{ $_var_name }}" | \ + jq -r '.plays[].tasks[].hosts[] | select(.failed != true) | .msg' | sort | uniq) if [ $? -ne 0 ] || [ -z "$_result" ]; then print_error "failed to get value of variable '$_var_name' for host(s) '$_hosts'" return 1 -- cgit v1.2.3