looping display in local facts

13 views
Skip to first unread message

Nicolas G

unread,
Nov 5, 2015, 2:08:41 PM11/5/15
to Ansible Project
Hi,

I have the bellow local fact working :

# /etc/ansible/facts.d/monitoring.fact
[tags]
web
=
db
=
app
=




In my template I have the bellow jinja code :

{% for facts in ansible_local.monitoring.tags %}
{{ facts }}
{% endfor %}



However this is rendering the facts tags like this :

web
app
db


I would like to have them in the same line like this :
web app db


Is there a new line escape character in Jinja that I can use ? 

PS: why doesn't Ansible display the facts in the correct order they are defined ? web app db instead of web db app ?

Thanks in advance,
N.





Brian Coca

unread,
Nov 5, 2015, 4:54:07 PM11/5/15
to Ansible Project
{{ ' '.join(ansible_local.monitoring.tags) }}

--
Brian Coca
Reply all
Reply to author
Forward
0 new messages