1
0
Fork 0
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:
James Cammarata 2015-12-08 14:00:17 -05:00
parent 7ffd578a9d
commit de690445bc
5 changed files with 6 additions and 2 deletions

View file

@ -34,6 +34,7 @@ class Block(Base, Become, Conditional, Taggable):
_rescue = FieldAttribute(isa='list', default=[]) _rescue = FieldAttribute(isa='list', default=[])
_always = FieldAttribute(isa='list', default=[]) _always = FieldAttribute(isa='list', default=[])
_delegate_to = FieldAttribute(isa='list') _delegate_to = FieldAttribute(isa='list')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
# for future consideration? this would be functionally # for future consideration? this would be functionally
# similar to the 'else' clause for exceptions # similar to the 'else' clause for exceptions

View file

@ -61,6 +61,7 @@ def hash_params(params):
class Role(Base, Become, Conditional, Taggable): class Role(Base, Become, Conditional, Taggable):
_delegate_to = FieldAttribute(isa='string') _delegate_to = FieldAttribute(isa='string')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
def __init__(self, play=None): def __init__(self, play=None):
self._role_name = None self._role_name = None

View file

@ -41,6 +41,7 @@ class RoleInclude(RoleDefinition):
""" """
_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): 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) super(RoleInclude, self).__init__(play=play, role_basedir=role_basedir, variable_manager=variable_manager, loader=loader)

View file

@ -72,6 +72,7 @@ class Task(Base, Conditional, Taggable, Become):
_changed_when = FieldAttribute(isa='string') _changed_when = FieldAttribute(isa='string')
_delay = FieldAttribute(isa='int', default=5) _delay = FieldAttribute(isa='int', default=5)
_delegate_to = FieldAttribute(isa='string') _delegate_to = FieldAttribute(isa='string')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
_failed_when = FieldAttribute(isa='string') _failed_when = FieldAttribute(isa='string')
_first_available_file = FieldAttribute(isa='list') _first_available_file = FieldAttribute(isa='list')
_loop = FieldAttribute(isa='string', private=True) _loop = FieldAttribute(isa='string', private=True)

View file

@ -289,7 +289,7 @@ class StrategyBase:
# find the host we're actually refering too here, which may # find the host we're actually refering too here, which may
# be a host that is not really in inventory at all # 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) 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) self.add_tqm_variables(task_vars, play=iterator._play)
if item is not None: if item is not None: