mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
@@ -48,6 +48,11 @@ options:
|
||||
- Overrides the role's metadata setting to allow using a role more than once with the same parameters.
|
||||
type: bool
|
||||
default: 'yes'
|
||||
handlers_from:
|
||||
description:
|
||||
- File to load from a role's C(handlers/) directory.
|
||||
default: main
|
||||
version_added: '2.8'
|
||||
notes:
|
||||
- Handlers are made available to the whole play.
|
||||
- "Since Ansible 2.7: variables defined in C(vars) and C(defaults) for the role are exposed at playbook parsing time.
|
||||
|
||||
@@ -61,6 +61,11 @@ options:
|
||||
type: bool
|
||||
default: 'no'
|
||||
version_added: '2.7'
|
||||
handlers_from:
|
||||
description:
|
||||
- File to load from a role's C(handlers/) directory.
|
||||
default: main
|
||||
version_added: '2.8'
|
||||
notes:
|
||||
- Handlers are made available to the whole play.
|
||||
- Before Ansible 2.4, as with C(include), this task could be static or dynamic, If static, it implied that it won't
|
||||
|
||||
@@ -230,7 +230,7 @@ class Role(Base, Become, Conditional, Taggable):
|
||||
raise AnsibleParserError("The tasks/main.yml file for role '%s' must contain a list of tasks" % self._role_name,
|
||||
obj=task_data, orig_exc=e)
|
||||
|
||||
handler_data = self._load_role_yaml('handlers')
|
||||
handler_data = self._load_role_yaml('handlers', main=self._from_files.get('handlers'))
|
||||
if handler_data:
|
||||
try:
|
||||
self._handler_blocks = load_list_of_blocks(handler_data, play=self._play, role=self, use_handlers=True, loader=self._loader,
|
||||
|
||||
@@ -41,7 +41,7 @@ class IncludeRole(TaskInclude):
|
||||
"""
|
||||
|
||||
BASE = ('name', 'role') # directly assigned
|
||||
FROM_ARGS = ('tasks_from', 'vars_from', 'defaults_from') # used to populate from dict in role
|
||||
FROM_ARGS = ('tasks_from', 'vars_from', 'defaults_from', 'handlers_from') # used to populate from dict in role
|
||||
OTHER_ARGS = ('apply', 'public', 'allow_duplicates') # assigned to matching property
|
||||
VALID_ARGS = tuple(frozenset(BASE + FROM_ARGS + OTHER_ARGS)) # all valid args
|
||||
|
||||
|
||||
Reference in New Issue
Block a user