Last active
March 28, 2021 08:54
-
-
Save zeitounator/8c5834bf149a514441f3cdf8cd683f05 to your computer and use it in GitHub Desktop.
Example for comment in https://devops.stackexchange.com/questions/13618
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
# This is an old ini style | |
- name: Set some vars | |
set_fact: var1=toto var2=titi | |
# Yaml style is easier to read... | |
- name: Set some vars | |
set_fact: | |
var1: toto | |
var2: titi | |
# ..and is more flexible with real use cases (Note mandatory quotes arrount the jinja value since it starts with a double moustache) | |
- name: Set complex vars ini | |
set_fact: a_list=["element1","element2"] a_dict={"key1":"value1"} a_word=toto a_string="I'm a phrase" jinja_string="{{ some_var }}" | |
- name: Set complex vars yaml | |
set_fact: | |
a_list: | |
- element1 | |
- element2 | |
a_dict: | |
key1: value1 | |
a_word: toto | |
a_string: I'm a phrase | |
jinja_string: "{{ some_var }}" # mandatory quotes in ansible because it starts with double moustache | |
other_string: "The value of var is {{ some_var }}" # Not mandatory here but I suggest you keep them as a good practice | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment