summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-10-12 09:54:31 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-10-12 09:54:31 +0200
commit1f6bab9ef5ffec068dac0a0785e703a55b335ce5 (patch)
tree0df51642c3f68cc9fa164a36408f97cc5bec118f
parent98df0c8b79a964c94df0c7b731fe790073214eba (diff)
downloadpostgresql-setup-tests-1f6bab9ef5ffec068dac0a0785e703a55b335ce5.tar.gz
postgresql-setup-tests-1f6bab9ef5ffec068dac0a0785e703a55b335ce5.tar.xz
postgresql-setup-tests-1f6bab9ef5ffec068dac0a0785e703a55b335ce5.zip
run_include: fix to be more like 'run_remote'
* ansible/dummy-wrapper.yml: Do not require 'script_name' variable. * ansible/run_include: Better work with actual directory when including other scripts or searching for included playbook.
-rw-r--r--ansible/dummy-wrapper.yml2
-rwxr-xr-xansible/run_include18
2 files changed, 15 insertions, 5 deletions
diff --git a/ansible/dummy-wrapper.yml b/ansible/dummy-wrapper.yml
index b645874..524b0ea 100644
--- a/ansible/dummy-wrapper.yml
+++ b/ansible/dummy-wrapper.yml
@@ -1,4 +1,4 @@
-- name: "{{ script_name }}"
+- name: "dummy-wrapper"
hosts: "{{ target }}"
remote_user: root
gather_facts: False
diff --git a/ansible/run_include b/ansible/run_include
index 3a47f68..1c7cd98 100755
--- a/ansible/run_include
+++ b/ansible/run_include
@@ -2,7 +2,17 @@
export ANSIBLE_HOST_KEY_CHECKING=False
-ansible-playbook -i hosts \
- --extra-vars "include_file=$1" \
- --extra-vars "script_name=dummy target=host" \
- ./dummy-wrapper.yml
+workdir="$(dirname "${BASH_SOURCE[0]}")"
+workdir=$(readlink -f "$workdir")
+
+export playbook=$(readlink -f "$1")
+
+( set -x
+ cd "$workdir"
+
+ ansible-playbook -i "$workdir/../hosts" \
+ --extra-vars "include_file=$playbook" \
+ --extra-vars "script_name=dummy" \
+ --extra-vars "target=host" \
+ "dummy-wrapper.yml"
+)