We do something like this for our mongodb connection string:
'mongodb://{% for h in groups.database %}{{ h }}{% if not loop.last %},{%
endif %}{% endfor %}/{{ mongo_database }}?replicaSet={{ mongo_replicaset }}'
On Mon, Sep 14, 2015 at 9:23 AM, Andrew Teil <[email protected]> wrote:
> Hi. I have the following inventory structure
>
> master1 ansible_ssh_host=10.0.45.11
> master2 ansible_ssh_host=10.0.45.12
> master3 ansible_ssh_host=10.0.45.13
> slave1 ansible_ssh_host=10.0.45.51
> slave2 ansible_ssh_host=10.0.45.52
> slave3 ansible_ssh_host=10.0.45.53
>
> [master_servers]
> master1
> master2
> master3
>
> ...
>
> Now I need a URL that looks something like this *zk://10.0.45.11:2181
> <http://10.0.45.11:2181>,10.0.45.12:2181
> <http://10.0.45.12:2181>,10.0.45.13:2181/mesos
> <http://10.0.45.13:2181/mesos>*
> For that reason I need a list of *ansible_ssh_host* variables for all
> servers in the group *master_servers*.
>
> I ended up with this
> [hostvars[groups['master_servers'][0]].ansible_ssh_host,
> hostvars[groups['master_servers'][1]].ansible_ssh_host,
> hostvars[groups['master_servers'][2]].ansible_ssh_host]
>
> but this solution takes only three servers not all in the group
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b3c8e2fe-ec8c-4655-88eb-cc5813c08673%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b3c8e2fe-ec8c-4655-88eb-cc5813c08673%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Matt Martz
@sivel
sivel.net
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9OvDj%3Dm-uz%2Bd0BpbxR_UsLJdS5WoDo4RCvJFafpTC4Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.