Skip to content

Commit 425c193

Browse files
authored
Merge pull request #487 from ypid/ansible/debops_hosts_support
Support to find Ansible hosts file in DebOps style projects
2 parents fb28eaf + 48d620d commit 425c193

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/_ansible

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ __host_file_location () {
6262
[[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts"
6363
[[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts"
6464
HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}}
65+
[[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts"
6566
[[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null
6667

6768
echo ${HOST_FILE}

src/_ansible-playbook

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ __host_file_location () {
6161
[[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts"
6262
[[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts"
6363
HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}}
64+
[[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts"
6465
[[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null
6566

6667
echo ${HOST_FILE}

0 commit comments

Comments
 (0)