Skip to content

Instantly share code, notes, and snippets.

@pixie79
Created March 12, 2015 16:35
Show Gist options
  • Save pixie79/8cf1bb0a56c451fde7cd to your computer and use it in GitHub Desktop.
Save pixie79/8cf1bb0a56c451fde7cd to your computer and use it in GitHub Desktop.
{% for x in groups['elasticsearch_masters'] %}
- name: {{ x }}
container_ip: "172.16.7.7"
{% endfor %}
@halberom
Copy link

create a dict

{
{% for x in groups['...'] %}
{{ x }}:'172.16.7.{{ loop.index }}',
{% endfor %}
}

@halberom
Copy link

then your set_fact is

set_fact: somevar={{ lookup... }}

and debug: var=somevar should show
{
foo.example.com: 172.16.7.1,
bob.example.com: 172.16.7.2,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment