[interfaces] Configure interfaces only if an IP exists
parent
a47058fcac
commit
fa41bdb816
|
@ -3,6 +3,7 @@
|
|||
{% set vlan_name = (item.name | replace('_', '-')) %}
|
||||
{% set subnet = query('ldap', 'network', vlan_name) %}
|
||||
{% set ips = query('ldap', 'ip', ansible_hostname, vlan_name) %}
|
||||
{% if (ips | ipv4 | length) > 0 %}
|
||||
auto {{ interfaces[item.name] }}
|
||||
iface {{ interfaces[item.name] }} inet static
|
||||
{% for ip in (ips | ipv4) %}
|
||||
|
@ -28,7 +29,9 @@ iface {{ interfaces[item.name] }} inet static
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if (ips | ipv6 | length) > 0 %}
|
||||
iface {{ interfaces[item.name] }} inet6 static
|
||||
{% for ip in (ips | ipv6) %}
|
||||
address {{ ip }}/64
|
||||
|
@ -40,3 +43,4 @@ iface {{ interfaces[item.name] }} inet6 static
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue