Treat "static: yes/no" with higher priority than "task_includes_static" in ansible.cfg
This commit is contained in:
parent
e1b7d4cb4d
commit
86768fdcc8
2 changed files with 8 additions and 7 deletions
|
@ -108,13 +108,14 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
|
||||||
all_vars = variable_manager.get_vars(loader=loader, play=play, task=t)
|
all_vars = variable_manager.get_vars(loader=loader, play=play, task=t)
|
||||||
templar = Templar(loader=loader, variables=all_vars)
|
templar = Templar(loader=loader, variables=all_vars)
|
||||||
|
|
||||||
# check to see if this include is static, which can be true if:
|
# check to see if this include is dynamic or static:
|
||||||
# 1. the user set the 'static' option to true
|
# 1. the user has set the 'static' option to false or true
|
||||||
# 2. one of the appropriate config options was set
|
# 2. one of the appropriate config options was set
|
||||||
# 3. the included file name contains no variables, and has no loop
|
if t.static is not None:
|
||||||
is_static = t.static or \
|
is_static = t.static
|
||||||
C.DEFAULT_TASK_INCLUDES_STATIC or \
|
else:
|
||||||
(use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC)
|
is_static = C.DEFAULT_TASK_INCLUDES_STATIC or \
|
||||||
|
(use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC)
|
||||||
|
|
||||||
if is_static:
|
if is_static:
|
||||||
if t.loop is not None:
|
if t.loop is not None:
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TaskInclude(Task):
|
||||||
# =================================================================================
|
# =================================================================================
|
||||||
# ATTRIBUTES
|
# ATTRIBUTES
|
||||||
|
|
||||||
_static = FieldAttribute(isa='bool', default=False)
|
_static = FieldAttribute(isa='bool', default=None)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(data, block=None, role=None, task_include=None, variable_manager=None, loader=None):
|
def load(data, block=None, role=None, task_include=None, variable_manager=None, loader=None):
|
||||||
|
|
Loading…
Reference in a new issue