mirror of https://github.com/ansible/ansible.git
Fix correct variable expansion in includes only_if.
There's not need to run the complete include through the templating engine. Several variables were not included before the conditional was evaluated.pull/603/head
parent
dab50574e0
commit
cd9f926b5f
@ -1,3 +1,4 @@
|
|||||||
---
|
---
|
||||||
duck: quack
|
duck: quack
|
||||||
cow: moo
|
cow: moo
|
||||||
|
extguard: " '$favcolor' == 'blue' "
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: test vars
|
||||||
|
action: shell echo $favcolor
|
||||||
|
|
||||||
|
- name: test vars_files
|
||||||
|
action: shell echo $duck
|
||||||
|
|
||||||
|
- name: test vars condition
|
||||||
|
action: shell echo RAN
|
||||||
|
only_if: $guard
|
||||||
|
|
||||||
|
- name: test vars_files condition
|
||||||
|
action: shell echo RAN
|
||||||
|
only_if: $extguard
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
# Test correct variable expansion in included files and only if
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
favcolor: "blue"
|
||||||
|
guard: ' "$favcolor" == "blue" '
|
||||||
|
vars_files:
|
||||||
|
- common_vars.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- include: playbook_included.yml
|
||||||
|
|
||||||
|
# test overrides of variables
|
||||||
|
- include: playbook_included.yml favcolor=red
|
||||||
Loading…
Reference in New Issue