diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 23e99c8656..7041aec604 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -319,14 +319,14 @@ COLOR_WARN: env: [{name: ANSIBLE_COLOR_WARN}] ini: - {key: warn, section: colors} -CONDITINAL_BARE_VARS: +CONDITIONAL_BARE_VARS: name: Allow bare variable evaluation in conditionals default: True type: boolean description: - - With this setting on (True), runing conditional evaluation 'var' is treated differently 'var.subkey' as the first is evaluted - directly while the second goes though the Jinja2 parser. But 'false' strings in 'var' get evaluated as booleans. - - With this settting off they both evalutate the same but in cases in which 'var' was 'false' (a string) it won't get evaluated as a boolean anymore. + - With this setting on (True), running conditional evaluation 'var' is treated differently than 'var.subkey' as the first is evaluated + directly while the second goes through the Jinja2 parser. But 'false' strings in 'var' get evaluated as booleans. + - With this setting off they both evaluate the same but in cases in which 'var' was 'false' (a string) it won't get evaluated as a boolean anymore. - Currently this setting defaults to 'True' but will soon change to 'False' and the setting itself will be removed in the future. - Expect the default to change in version 2.10 and that this setting eventually will be deprecated after 2.12 env: [{name: ANSIBLE_CONDITIONAL_BARE_VARS}] diff --git a/lib/ansible/playbook/conditional.py b/lib/ansible/playbook/conditional.py index eb8aa5155c..04b49d7167 100644 --- a/lib/ansible/playbook/conditional.py +++ b/lib/ansible/playbook/conditional.py @@ -114,7 +114,7 @@ class Conditional: if isinstance(conditional, bool): return conditional - if C.CONDITINAL_BARE_VARS: + if C.CONDITIONAL_BARE_VARS: if conditional in all_vars and VALID_VAR_REGEX.match(conditional): display.deprecated('evaluating %s as a bare variable, this behaviour will go away and you might need to add |bool' ' to the expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle.' % conditional, "2.12") diff --git a/test/integration/targets/conditionals/play.yml b/test/integration/targets/conditionals/play.yml index e69e477ebe..10b24589a0 100644 --- a/test/integration/targets/conditionals/play.yml +++ b/test/integration/targets/conditionals/play.yml @@ -6,9 +6,9 @@ vars_files: - vars/main.yml tasks: - - name: set conditial bare vars status + - name: set conditional bare vars status set_fact: - bare: "{{lookup('config', 'CONDITINAL_BARE_VARS')|bool}}" + bare: "{{lookup('config', 'CONDITIONAL_BARE_VARS')|bool}}" - name: test conditional '==' shell: echo 'testing' @@ -536,14 +536,14 @@ - top is skipped - sub is skipped - - name: test that 'comparisson expression' item works with_items + - name: test that 'comparison expression' item works with_items assert: that: - item with_items: - 1 == 1 - - name: test that 'comparisson expression' item works in loop + - name: test that 'comparison expression' item works in loop assert: that: - item