diff options
author | David Shrewsbury <Shrews@users.noreply.github.com> | 2021-03-15 20:39:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 20:39:59 +0100 |
commit | 1e5ccb326fa49046da7a06e42734836b99e2d5cc (patch) | |
tree | a35d86e9e1884645bf3f69b495cd61285a4500fe /test/integration | |
parent | Fix typo in porting_guide_3.rst (#73871) (diff) | |
download | ansible-1e5ccb326fa49046da7a06e42734836b99e2d5cc.tar.xz ansible-1e5ccb326fa49046da7a06e42734836b99e2d5cc.zip |
Allow for searching handler subdir for included tasks (#73809)
* Allow for searching handler subdir for included tasks
Diffstat (limited to 'test/integration')
5 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/A.yml b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/A.yml new file mode 100644 index 0000000000..b7520c77cb --- /dev/null +++ b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/A.yml @@ -0,0 +1 @@ +- debug: msg="handler with tasks from A.yml called" diff --git a/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/main.yml b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/main.yml new file mode 100644 index 0000000000..ba2e8f69c2 --- /dev/null +++ b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/handlers/main.yml @@ -0,0 +1,5 @@ +- name: role-based handler from handler subdir + include_tasks: A.yml + +- name: role-based handler from tasks subdir + include_tasks: B.yml diff --git a/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/tasks/B.yml b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/tasks/B.yml new file mode 100644 index 0000000000..956c975484 --- /dev/null +++ b/test/integration/targets/handlers/roles/test_role_handlers_include_tasks/tasks/B.yml @@ -0,0 +1 @@ +- debug: msg="handler with tasks from B.yml called" diff --git a/test/integration/targets/handlers/runme.sh b/test/integration/targets/handlers/runme.sh index 59c81bcec0..cefa926b5f 100755 --- a/test/integration/targets/handlers/runme.sh +++ b/test/integration/targets/handlers/runme.sh @@ -87,6 +87,9 @@ set -e # https://github.com/ansible/ansible/issues/47287 [ "$(ansible-playbook test_handlers_including_task.yml -i ../../inventory -v "$@" | grep -E -o 'failed=[0-9]+')" = "failed=0" ] +# https://github.com/ansible/ansible/issues/71222 +ansible-playbook test_role_handlers_including_tasks.yml -i ../../inventory -v "$@" + # https://github.com/ansible/ansible/issues/27237 set +e result="$(ansible-playbook test_handlers_template_run_once.yml -i inventory.handlers "$@" 2>&1)" diff --git a/test/integration/targets/handlers/test_role_handlers_including_tasks.yml b/test/integration/targets/handlers/test_role_handlers_including_tasks.yml new file mode 100644 index 0000000000..47d8f00ac2 --- /dev/null +++ b/test/integration/targets/handlers/test_role_handlers_including_tasks.yml @@ -0,0 +1,18 @@ +--- +- name: Verify a role handler can include other tasks from handlers and tasks subdirs + hosts: testhost + roles: + - test_role_handlers_include_tasks + + tasks: + - name: notify a role-based handler (include tasks from handler subdir) + debug: + msg: notifying role handler + changed_when: yes + notify: role-based handler from handler subdir + + - name: notify a role-based handler (include tasks from tasks subdir) + debug: + msg: notifying another role handler + changed_when: yes + notify: role-based handler from tasks subdir |