]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
now you can use a network link name with a hyphen 1045/head
authorGunwoo Gim (a.k.a. Nicho1as) <wind8702@gmail.com>
Mon, 24 Oct 2016 15:49:11 +0000 (00:49 +0900)
committerGunwoo Gim (a.k.a. Nicho1as) <wind8702@gmail.com>
Mon, 24 Oct 2016 15:49:11 +0000 (00:49 +0900)
roles/ceph-common/templates/ceph.conf.j2
roles/ceph-common/templates/mon_addr_interface.j2

index a068392dc930c37073e2f1386b0f1e29212cfe8b..4d72a0b8ab704ac5a6b551458f0a38fdab3cd947 100644 (file)
@@ -24,7 +24,7 @@ mon_initial_members = {% if groups[mon_group_name] is defined %}{% for host in g
 {% if monitor_address_block is defined %}
 mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_all_ipv4_addresses'] | ipaddr(monitor_address_block) | first }}{% if not loop.last %},{% endif %}{% endfor %}
 {% elif groups[mon_group_name] is defined %}
-mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_' + monitor_interface]['ipv4']['address'] }}{% if not loop.last %},{% endif %}{% endfor %}
+mon host = {% for host in groups[mon_group_name] %}{% for key in hostvars[host].iterkeys() %}{% if hostvars[host][key]['macaddress'] is defined and hostvars[host][key]['device'] is defined and hostvars[host][key]['device'] == monitor_interface %}{{ hostvars[host][key]['ipv4']['address'] }}{% endif %}{% endfor %}{% if not loop.last %},{% endif %}{% endfor %}
 {% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
 {% include 'mon_addr_interface.j2' %}
 {% else %}
index 91db007857b87a25ded6901116a7007cbc8d3212..107483177c3752654b15ae5b7337f991d7bacf79 100644 (file)
@@ -1 +1,7 @@
-mon host = {% for host in groups[mon_group_name] %}{{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}{% if not loop.last %},{% endif %}{% endfor %}
+mon host = {% for host in groups[mon_group_name] %}
+  {% for key in hostvars[host].iterkeys() %}
+    {% if hostvars[host][key]['macaddress'] is defined and hostvars[host][key]['device'] is defined and hostvars[host][key]['device'] == monitor_interface %}
+      {{ hostvars[host][key]['ipv4']['address'] }}
+    {% endif %}
+  {% endfor %}
+{% if not loop.last %},{% endif %}{% endfor %}