mirror of https://github.com/ansible/ansible.git
import_role - allow subdirectories with _from options (#82642)
* Allow subdirectories with import_role _from options
Add tests that tasks_from is restricted to the role
Note that a task like:
- import_role:
name: role
tasks_from: tasks/entrypoint.yml
will now load tasks from "{{ role_path }}/tasks/tasks/entrypoint.yml"
instead of "{{ role_path }}/tasks/entrypoint.yml". This change in
behavior matches include_role.
* better test case (filename doesn't match one in tasks/)
Fixes #82584
pull/82651/head
parent
da26e2a5eb
commit
a452c53375
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- import_role - allow subdirectories with ``_from`` options for parity with ``include_role`` (https://github.com/ansible/ansible/issues/82584).
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
- hosts: testhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- import_role:
|
||||||
|
name: a
|
||||||
|
tasks_from: subdir/../../../../no_outside.yml
|
||||||
@ -0,0 +1 @@
|
|||||||
|
- debug: msg=subdir
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- hosts: testhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- import_role:
|
||||||
|
name: a
|
||||||
|
tasks_from: subdir/entrypoint.yml
|
||||||
|
- include_role:
|
||||||
|
name: a
|
||||||
|
tasks_from: subdir/entrypoint.yml
|
||||||
Loading…
Reference in New Issue