summaryrefslogtreecommitdiff
path: root/common/utils.sh
diff options
context:
space:
mode:
Diffstat (limited to 'common/utils.sh')
-rw-r--r--common/utils.sh4
1 files changed, 2 insertions, 2 deletions
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