|
@@ -87,17 +87,17 @@ protocol ospf IGP {
|
|
|
{#-
|
|
|
# Backbone OpenVPNs
|
|
|
#}
|
|
|
-{%- set interfaces = [] %}
|
|
|
+{%- set interfaces = {} %}
|
|
|
{%- for vpn, vpn_config in salt['pillar.get']('ovpn', {}).items () %}
|
|
|
{%- if grains['id'] in vpn_config %}
|
|
|
{%- set host_config = vpn_config.get (grains['id'], {}).get ('config', {}) %}
|
|
|
{%- set interface = host_config.get ('interface', vpn_config.get ('interface', '')) %}
|
|
|
{%- if interface.startswith ('bb-') or interface.startswith ('ovpn-') or interface.startswith ('oob-') %}
|
|
|
- {%- do interfaces.append (interface) %}
|
|
|
+ {%- do interfaces.update({interface: { 'cost': vpn_config.get (grains['id'], {}).get ('config', {}).get ('cost', False) }}) %}
|
|
|
{%- endif %}
|
|
|
{%- endif %}
|
|
|
{%- endfor %}
|
|
|
-{%- for interface in interfaces|sort %}
|
|
|
+{%- for interface, iface_config in interfaces.items()|sort %}
|
|
|
interface "{{ interface }}" {
|
|
|
{%- if interface.startswith ('ovpn-er-') and proto == 'v6' %}
|
|
|
type broadcast;
|
|
@@ -105,7 +105,9 @@ protocol ospf IGP {
|
|
|
type pointopoint;
|
|
|
{%- endif %}
|
|
|
|
|
|
- {%- if interface.startswith ('ovpn-cr') %}
|
|
|
+ {%- if iface_config.cost %}
|
|
|
+ cost {{ iface_config.cost }};
|
|
|
+ {%- elif interface.startswith ('ovpn-cr') %}
|
|
|
cost 5000;
|
|
|
{%- else %}
|
|
|
cost 10000;
|