I have a hosts
file including the following contents
[elasticsearch_nodes]
host1 os=linux
host2 os=linux
host3 os=linux
In a .j2
template I want to get the the list of [elasticsearch_nodes]
{{ some_ansible_magic_here }}
# should output "host1","host2","host3"
How do I do this?
I do have this as well to help with the quotes and the commas when I have the list.
{% for host in some_sort_of_ansible_magic_to_get_me_that_list_i_need %}
"{{ host }}"{% if not loop.last %},{% endif %}
{% endfor %}