diff --git a/src/_ansible b/src/_ansible index 60864d4..e3a1d0c 100644 --- a/src/_ansible +++ b/src/_ansible @@ -62,6 +62,7 @@ __host_file_location () { [[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts" [[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts" HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}} + [[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts" [[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null echo ${HOST_FILE} diff --git a/src/_ansible-playbook b/src/_ansible-playbook index f0a85d0..95aa261 100644 --- a/src/_ansible-playbook +++ b/src/_ansible-playbook @@ -61,6 +61,7 @@ __host_file_location () { [[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts" [[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts" HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}} + [[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts" [[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null echo ${HOST_FILE}