-
-
Save canit00/7d0be3e5cf793d162c4975468d2f4544 to your computer and use it in GitHub Desktop.
Sample Ansible Playbook template+iteritems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following should be: | |
SAMPLE: | |
one -> first | |
two -> second | |
three -> third | |
ACTUAL: | |
{% for k, v in d.iteritems() %} | |
{{ k }} -> {{ v }} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 'Simple Test of iteritems()' | |
hosts: localhost | |
gather_facts: false | |
vars: | |
d: | |
one: 'first' | |
two: 'second' | |
three: 'third' | |
tasks: | |
- name: '(optional) debug output' | |
debug: | |
msg: '{{ d.iteritems() }}' | |
when: debug |d(false) | |
- name: 'Iterate over template' | |
template: | |
src: in.j2 | |
dest: /tmp/out.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment