allow references to names of variables in with_items without needing to surround them with Jinja2 '{{' delimeters

This commit is contained in:
Michael DeHaan
2013-04-10 18:42:54 -04:00
parent 9ac25bb8f6
commit f0b21dcc0f
5 changed files with 61 additions and 40 deletions

View File

@@ -7,16 +7,25 @@
- hosts: all
tasks:
- shell: echo 'hello {{ ansible_hostname.upper() }}'
vars:
a_list:
- a
- b
- c
- shell: echo 'match'
tasks:
- shell: echo hello {{ ansible_hostname.upper() }}
- shell: echo match
when: 2 == 2
- shell: echo 'no match'
- shell: echo no match
when: 2 == 2 + 1
- shell: echo '{{ ansible_os_family }}'
- shell: echo {{ ansible_os_family }}
- shell: echo {{ item }}
with_items: a_list
- shell: echo 'RedHat'
when: ansible_os_family == 'RedHat'