difference takes two lists, so
wsrep_cluster_address=gcomm://{{databases |
difference([ansible_ipv4.bond0])}};
join(',') creates a string, you want to use split (or if databases is a
list already, nothing)
note the square brackets around ansible_ipv4.bond0, basically turning it
into a list item.
On Saturday, 12 September 2015 19:33:54 UTC+1, William Muriithi wrote:
>
> Afternoon,
>
> I have a template where I have a group of 4 IPs. I want to make a
> list of the 3 IPs - These 3 IPs are for the other database systems,
> so need to except the IP of the current database where the template is
> being deployed. The line that does this is below, but over the can¹t
> seem to get it working despite looking at it for a couple of years
>
>
>
> /etc/ansible/roles/mysql/templates/template/galera.cnf.j2
>
>
> Š.
>
> wsrep_cluster_address=gcomm://{{databases | join(',') | difference
> (ansible_ipv4.bond0)}};
> Š..
>
>
>
> When I run the playbook, it fails with the following error.
>
> fatal: [192.168.149.241] => {'msg': "AnsibleUndefinedVariable: One or
> more undefined variables: 'ansible_ipv4' is undefined", 'failed':
> True}
> fatal: [192.168.149.241] => {'msg': 'One or more items failed.',
> 'failed': True, 'changed': False, 'results': [{'msg':
> "AnsibleUndefinedVariable: One or more undefined variables:
> 'ansible_ipv4' is undefined", 'failed':
> True}]} FATAL: all hosts have already failed ‹ aborting
>
>
>
> What would be the appropriate way to use difference filter to achieve
> my goal here?
>
> Regards,
>
> William
>
--
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/c187f1dc-290e-48e9-9add-a54e5c5d76ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.