Allowing args: "{{some_var}}" for task params again

This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
This commit is contained in:
James Cammarata 2015-07-24 10:31:14 -04:00
parent 681eab1158
commit e526743b4f
4 changed files with 27 additions and 4 deletions

View file

@ -60,6 +60,13 @@ class TaskExecutor:
self._loader = loader
self._shared_loader_obj = shared_loader_obj
try:
from __main__ import display
self._display = display
except ImportError:
from ansible.utils.display import Display
self._display = Display()
def run(self):
'''
The main executor entrypoint, where we determine if the specified
@ -229,6 +236,12 @@ class TaskExecutor:
prev_var = self._task.args.pop('var')
self._task.post_validate(templar=templar)
if '_variable_params' in self._task.args:
variable_params = self._task.args.pop('_variable_params')
if isinstance(variable_params, dict):
self._display.deprecated("Using variables for task params is unsafe, especially if the variables come from an external source like facts")
variable_params.update(self._task.args)
self._task.args = variable_params
if prev_var is not None:
self._task.args['var'] = prev_var