Skip to content

Instantly share code, notes, and snippets.

@piotr-gbyliczek
Created July 24, 2017 18:48
Show Gist options
  • Save piotr-gbyliczek/5dc07776d17fba74598a250b54ce8b72 to your computer and use it in GitHub Desktop.
Save piotr-gbyliczek/5dc07776d17fba74598a250b54ce8b72 to your computer and use it in GitHub Desktop.
cluster_addresses="{% for node in groups['all'] -%}{{ hostvars[node]["ansible_" + comm_if]["ipv4"]["address"] }}{% if not loop.last %},{% endif %} {%- endfor %}"
[...]
node_address={{ "ansible_"+comm_if["ipv4"]["address"] }}
[...]
TASK [galera : build config file] ****************************************************************************************************************************************************************************************************
fatal: [node2]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute u'ansible_eth0'"}
Debugger invoked
(debug) p vars['hostvars']['node2']
{u'ansible_all_ipv4_addresses': [u'192.168.1.1'],
u'ansible_all_ipv6_addresses': [u'aaaa::1111:aa:aaaa:aaaa'],
u'ansible_apparmor': {u'status': u'disabled'},
[...]
u'ansible_distribution': u'CentOS',
u'ansible_distribution_major_version': u'7',
u'ansible_distribution_release': u'Core',
u'ansible_distribution_version': u'7.3.1611',
[...]
u'ansible_eth0': {u'active': True,
u'device': u'eth0',
[...]
u'ipv4': {u'address': u'192.168.1.1',
u'broadcast': u'192.168.1.255',
u'netmask': u'255.255.255.0',
u'network': u'192.168.1.0'},
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment