From: dexter Date: Wed, 26 Aug 2015 08:11:21 +0000 (+0800) Subject: Fix for error when the nodes don't have the same interface name. X-Git-Tag: v1.0.0~120^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=873c5cffb25f17115fb355eb35ee2d1d2d129331;p=ceph-ansible.git 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'] --- diff --git a/roles/ceph-common/templates/ceph.conf.j2 b/roles/ceph-common/templates/ceph.conf.j2 index d3c73e093..170d67514 100644 --- a/roles/ceph-common/templates/ceph.conf.j2 +++ b/roles/ceph-common/templates/ceph.conf.j2 @@ -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 %}