From 99d2f3ea348063a13bb826c9b5631ef432a95894 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 20 Apr 2018 16:32:18 -0400 Subject: [PATCH] allow Jinja2 in ansible -a when ALLOW_JINJA_IN_EXTRA_VARS is 'always' --- awx/main/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index dc3c8df28b..8da7b9c1b5 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -2266,7 +2266,10 @@ class RunAdHocCommand(BaseTask): args.extend(['-e', '@%s' % (extra_vars_path)]) args.extend(['-m', ad_hoc_command.module_name]) - args.extend(['-a', sanitize_jinja(ad_hoc_command.module_args)]) + module_args = ad_hoc_command.module_args + if settings.ALLOW_JINJA_IN_EXTRA_VARS != 'always': + module_args = sanitize_jinja(module_args) + args.extend(['-a', module_args]) if ad_hoc_command.limit: args.append(ad_hoc_command.limit)