summaryrefslogtreecommitdiff
path: root/test/integration/targets/lookup_env/runme.sh
blob: 698d6bfa8cd885382cc1f5fac6f4f7ed22c663b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

set -ex

unset USR
# this should succeed and return 'nobody' as var is undefined
ansible -m debug -a msg="{{ lookup('env', 'USR', default='nobody')}}" localhost |grep nobody
# var is defined but empty, so should return empty
USR='' ansible -m debug -a msg="{{ lookup('env', 'USR', default='nobody')}}" localhost |grep -v nobody

# this should fail with undefined
ansible -m debug -a msg="{{ lookup('env', 'USR', default=Undefined)}}" localhost && exit 1 || exit 0