diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 40ca2569c6..8c288fc1d4 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -82,7 +82,7 @@ class Task(Base, Conditional, Taggable, Become): _poll = FieldAttribute(isa='int') _register = FieldAttribute(isa='string') _retries = FieldAttribute(isa='int', default=3) - _until = FieldAttribute(isa='list') # ? + _until = FieldAttribute(isa='list') def __init__(self, block=None, role=None, task_include=None): ''' constructors a task, without the Task.load classmethod, it will be pretty blank ''' diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 1ead5c8438..671ea0869d 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.compat.six.moves import queue as Queue -from ansible.compat.six import iteritems, text_type +from ansible.compat.six import iteritems, text_type, string_types import time @@ -431,6 +431,17 @@ class StrategyBase: # then we create a temporary set of vars to ensure the variable reference is unique temp_vars = b._task_include.vars.copy() temp_vars.update(included_file._args.copy()) + # pop tags out of the include args, if they were specified there, and assign + # them to the include. If the include already had tags specified, we raise an + # error so that users know not to specify them both ways + tags = temp_vars.pop('tags', []) + if isinstance(tags, string_types): + tags = [ tags ] + if len(tags) > 0: + if len(b._task_include.tags) > 0: + raise AnsibleParserError("Include tasks should not specify tags in more than one way (both via args and directly on the task)", obj=included_file._task._ds) + self._display.deprecated("You should not specify tags in the include parameters. All tags should be specified using the task-level option") + b._task_include.tags = tags b._task_include.vars = temp_vars return block_list