Created
October 12, 2013 02:11
-
-
Save darkone23/6944912 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # ansible uses jinja templates for variable substitution | |
| # because of this, you are free to use all of jinja anywhere ansible templates | |
| # for example the arguments to modules | |
| - name: pattern or antipattern? you decide | |
| hosts: local | |
| connection: local | |
| vars: | |
| iferate: no | |
| messages: | |
| - puters | |
| - editors | |
| - woah | |
| message: peas and potatoes | |
| tasks: | |
| - shell: > | |
| {% if iferate %} # do stupid things | |
| {% for message in messages %} echo {{ message }}; {% endfor %} | |
| {% else %} | |
| echo {{ message }} | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment