now you can use a network link name with a hyphen

pull/1045/head
Gunwoo Gim (a.k.a. Nicho1as) 2016-10-25 00:49:11 +09:00
parent e616ccf894
commit 0421ade0df
2 changed files with 8 additions and 2 deletions

View 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 %} {% 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 %} 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 %} {% 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" %} {% elif (hostvars[host]['monitor_interface'] is defined and hostvars[host]['monitor_interface'] != "interface") or monitor_interface != "interface" %}
{% include 'mon_addr_interface.j2' %} {% include 'mon_addr_interface.j2' %}
{% else %} {% else %}

View 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 %}