Merge pull request #1045 from wind0204/pr-monitor_interface_with_hyphens

now you can use a network link name with a hyphen
pull/1067/head
Leseb 2016-10-31 21:15:55 +01:00 committed by GitHub
commit 59ee496088
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 %}
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 %}

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