I have a DB Server and a bunch of webservers (also running the application
as of now). All the servers are connected via private networking on eth1.
Now I need to configure postgresql (I am using the role
Ansibles.postgresql) to accept password authenticated requests on eth1. The
way to do this in Ansibles.postgresql role is to set value of variable to
an array containing all the IPs of hosts that should be allowed to auth
like so:
postgresql_pg_hba_passwd_hosts: ['10.129.181.241/32', 'my_other_ip', ...]
What I need to do now is to figure out a (the best) way to assign all the
IPs on eht1 of all the servers in the group web to this variable and suffix
them all with "/32"
I know I can get the IPs via
{% for host in groups['web'] %}
{{ hostvars[host]['ansible_eth1']['ipv4']['address'] }}
{% endfor %}
But this only works in a template, right? (Since jinja2 is not interpreted
in playbookfiles?)
So I am looking for a complete answer of how to best achieve this in a most
(Ansible-)standard way. I am sure this is a fairly common task, but right
now I just can't see it.
Am Donnerstag, 17. Juli 2014 14:35:52 UTC+2 schrieb Michael DeHaan:
>
> If you're going to reask questions from Stack Overflow please paste the
> question here and save us the click.
>
> We're not going to answer over on StackOverflow.
>
> It's also much better to just ask here as you'll get quicker answers -
> much larger audience reading things.
>
> I'm also unclear what you are having problems with so maybe you can
> elaborate a bit.
>
> Thanks!
>
>
> On Thu, Jul 17, 2014 at 4:59 AM, Benjamin Bauer <[email protected]
> <javascript:>> wrote:
>
>> Can anybody help me on this:
>> http://stackoverflow.com/questions/24798382/how-to-assign-an-array-to-a-variabel-in-an-ansible-playbook
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/904bbe9d-fd30-480e-8937-c5080309123b%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/904bbe9d-fd30-480e-8937-c5080309123b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/317cbf8d-dac9-43d3-abe2-6ade3606457c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.