mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make fact delegating configurable, defaulting to 1.x behavior
This commit is contained in:
parent
7ffd578a9d
commit
de690445bc
5 changed files with 6 additions and 2 deletions
|
@ -34,6 +34,7 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
_rescue = FieldAttribute(isa='list', default=[])
|
||||
_always = FieldAttribute(isa='list', default=[])
|
||||
_delegate_to = FieldAttribute(isa='list')
|
||||
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
|
||||
|
||||
# for future consideration? this would be functionally
|
||||
# similar to the 'else' clause for exceptions
|
||||
|
|
|
@ -61,6 +61,7 @@ def hash_params(params):
|
|||
class Role(Base, Become, Conditional, Taggable):
|
||||
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
|
||||
|
||||
def __init__(self, play=None):
|
||||
self._role_name = None
|
||||
|
|
|
@ -40,7 +40,8 @@ class RoleInclude(RoleDefinition):
|
|||
is included for execution in a play.
|
||||
"""
|
||||
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
|
||||
|
||||
def __init__(self, play=None, role_basedir=None, variable_manager=None, loader=None):
|
||||
super(RoleInclude, self).__init__(play=play, role_basedir=role_basedir, variable_manager=variable_manager, loader=loader)
|
||||
|
|
|
@ -72,6 +72,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
_changed_when = FieldAttribute(isa='string')
|
||||
_delay = FieldAttribute(isa='int', default=5)
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
|
||||
_failed_when = FieldAttribute(isa='string')
|
||||
_first_available_file = FieldAttribute(isa='list')
|
||||
_loop = FieldAttribute(isa='string', private=True)
|
||||
|
|
|
@ -289,7 +289,7 @@ class StrategyBase:
|
|||
|
||||
# find the host we're actually refering too here, which may
|
||||
# be a host that is not really in inventory at all
|
||||
if task.delegate_to is not None:
|
||||
if task.delegate_to is not None and task.delegate_facts:
|
||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
|
||||
self.add_tqm_variables(task_vars, play=iterator._play)
|
||||
if item is not None:
|
||||
|
|
Loading…
Reference in a new issue