add option to ignore $legacy variable style substitution
This commit is contained in:
parent
67e67bca1f
commit
542eeeb5d6
3 changed files with 13 additions and 0 deletions
|
@ -102,6 +102,13 @@ sudo_exe=sudo
|
|||
#
|
||||
# hash_behaviour=replace
|
||||
|
||||
# How to handle variable replacement - as of 1.2, Jinja2 variable syntax is
|
||||
# preferred, but we still support the old $variable replacement too.
|
||||
# If you change legacy_playbook_variables to no then Ansible will no longer
|
||||
# try to do replacement on $variable style variables.
|
||||
#
|
||||
# legacy_playbook_variables=yes
|
||||
|
||||
# if you need to use jinja2 extensions, you can list them here
|
||||
# use a coma to separate extensions, e.g. :
|
||||
# jinja2_extensions=jinja2.ext.do,jinja2.ext.i18n
|
||||
|
|
|
@ -94,6 +94,7 @@ DEFAULT_KEEP_REMOTE_FILES = get_config(p, DEFAULTS, 'keep_remote_files', 'ANSIBL
|
|||
DEFAULT_SUDO_EXE = get_config(p, DEFAULTS, 'sudo_exe', 'ANSIBLE_SUDO_EXE', 'sudo')
|
||||
DEFAULT_SUDO_FLAGS = get_config(p, DEFAULTS, 'sudo_flags', 'ANSIBLE_SUDO_FLAGS', '-H')
|
||||
DEFAULT_HASH_BEHAVIOUR = get_config(p, DEFAULTS, 'hash_behaviour', 'ANSIBLE_HASH_BEHAVIOUR', 'replace')
|
||||
DEFAULT_LEGACY_PLAYBOOK_VARIABLES = get_config(p, DEFAULTS, 'legacy_playbook_variables', 'ANSIBLE_LEGACY_PLAYBOOK_VARIABLES', 'yes')
|
||||
DEFAULT_JINJA2_EXTENSIONS = get_config(p, DEFAULTS, 'jinja2_extensions', 'ANSIBLE_JINJA2_EXTENSIONS', None)
|
||||
DEFAULT_EXECUTABLE = get_config(p, DEFAULTS, 'executable', 'ANSIBLE_EXECUTABLE', '/bin/sh')
|
||||
|
||||
|
|
|
@ -142,6 +142,11 @@ def _legacy_varFind(basedir, text, vars, lookup_fatal, depth, expand_lists):
|
|||
original data in the caller.
|
||||
'''
|
||||
|
||||
# short circuit this whole function if we have specified we don't want
|
||||
# legacy var replacement
|
||||
if C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES == 'no':
|
||||
return None
|
||||
|
||||
start = text.find("$")
|
||||
if start == -1:
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue