123456789101112131415161718192021222324 |
- {#-
- # OpenVPN VPNs (if any)
- #}
- {%- set networks = [] %}
- {%- for netname, network in salt['pillar.get']('ovpn', {}).items () if grains['id'] in network %}
- {%- do networks.append (netname) %}
- {%- endfor %}
- {%- for netname in networks|sort %}
- {%- set network = salt['pillar.get']('ovpn:' ~ netname) %}
- {%- set network_config = network.get ('config') %}
- {%- set host_stanza = network.get (grains['id']) %}
- {%- set host_config = host_stanza.get ('config', {}) %}
- #
- # {{ network_config.get ('_desc') }}
- {%- set interface = host_config.get ('interface', network_config.get ('interface')) %}
- {%- if network_config.get ('dev-type', 'tap') == 'tap' %}
- iface {{ interface }}
- {%- for ip in host_stanza.get ('ip', []) %}
- {%- set netmask = network_config['netmask_v6'] if ':' in ip else network_config['netmask_v4'] %}
- address {{ ip }}/{{ netmask }}
- {%- endfor %}
- {%- endif %} {#- dev-type tap #}
- {% endfor %} {#- network #}
|