diff options
Diffstat (limited to '')
5 files changed, 78 insertions, 0 deletions
diff --git a/test/integration/targets/path_lookups/aliases b/test/integration/targets/path_lookups/aliases new file mode 100644 index 0000000..1d28bdb --- /dev/null +++ b/test/integration/targets/path_lookups/aliases @@ -0,0 +1,2 @@ +shippable/posix/group5 +context/controller diff --git a/test/integration/targets/path_lookups/play.yml b/test/integration/targets/path_lookups/play.yml new file mode 100644 index 0000000..233f972 --- /dev/null +++ b/test/integration/targets/path_lookups/play.yml @@ -0,0 +1,49 @@ +- name: setup state + hosts: localhost + gather_facts: false + tasks: + - file: path={{playbook_dir}}/files state=directory + - file: path={{playbook_dir}}/roles/showfile/files state=directory + - copy: dest={{playbook_dir}}/roles/showfile/files/testfile content='in role files' + - copy: dest={{playbook_dir}}/roles/showfile/testfile content='in role' + - copy: dest={{playbook_dir}}/roles/showfile/tasks/testfile content='in role tasks' + - copy: dest={{playbook_dir}}/files/testfile content='in files' + - copy: dest={{playbook_dir}}/testfile content='in local' + +- import_playbook: testplay.yml + vars: + remove: nothing + role_out: in role files + play_out: in files + +- import_playbook: testplay.yml + vars: + remove: roles/showfile/files/testfile + role_out: in role + play_out: in files + +- import_playbook: testplay.yml + vars: + remove: roles/showfile/testfile + role_out: in role tasks + play_out: in files + +- import_playbook: testplay.yml + vars: + remove: roles/showfile/tasks/testfile + role_out: in files + play_out: in files + +- import_playbook: testplay.yml + vars: + remove: files/testfile + role_out: in local + play_out: in local + +- name: cleanup + hosts: localhost + gather_facts: false + tasks: + - file: path={{playbook_dir}}/testfile state=absent + - file: path={{playbook_dir}}/files state=absent + - file: path={{playbook_dir}}/roles/showfile/files state=absent diff --git a/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml b/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml new file mode 100644 index 0000000..1b38057 --- /dev/null +++ b/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml @@ -0,0 +1,2 @@ +- name: relative to role + set_fact: role_result="{{lookup('file', 'testfile')}}" diff --git a/test/integration/targets/path_lookups/runme.sh b/test/integration/targets/path_lookups/runme.sh new file mode 100755 index 0000000..754150b --- /dev/null +++ b/test/integration/targets/path_lookups/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eux + +ansible-playbook play.yml -i ../../inventory -v "$@" diff --git a/test/integration/targets/path_lookups/testplay.yml b/test/integration/targets/path_lookups/testplay.yml new file mode 100644 index 0000000..8bf4553 --- /dev/null +++ b/test/integration/targets/path_lookups/testplay.yml @@ -0,0 +1,20 @@ +- name: test initial state + hosts: localhost + gather_facts: false + pre_tasks: + - name: remove {{ remove }} + file: path={{ playbook_dir }}/{{ remove }} state=absent + roles: + - showfile + post_tasks: + - name: from play + set_fact: play_result="{{lookup('file', 'testfile')}}" + + - name: output stage {{ remove }} removed + debug: msg="play> {{play_out}}, role> {{role_out}}" + + - name: verify that result match expected + assert: + that: + - 'play_result == play_out' + - 'role_result == role_out' |