Fix for error when the nodes don't have the same interface name.

This is a rare case but it happens. Since we're just calling
`monitor_interface` and not `hostvars[host]['monitor_interface'],
an error may occur when the current host's interface does not
exist on the other hosts. (eg. eth0 exists for node0, but it does
not exist on node1 and node2)

Fix for this is to use hostvars[host]['monitor_interface']
pull/389/head
dexter 2015-08-26 16:11:21 +08:00
parent 453bf50126
commit 873c5cffb2
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@
{% if hostvars[host]['ansible_hostname'] is defined %}
[mon.{{ hostvars[host]['ansible_hostname'] }}]
host = {{ hostvars[host]['ansible_hostname'] }}
mon addr = {{ hostvars[host]['ansible_' + monitor_interface]['ipv4']['address'] }}
mon addr = {{ hostvars[host]['ansible_' + hostvars[host][monitor_interface]]['ipv4']['address'] }}
{% endif %}
{% endfor %}