forked from freifunk-berlin/bbb-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
corerouter: add tunnels option using tunspace
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#jinja2: trim_blocks: "true", lstrip_blocks: "true" | ||
{% for network in networks | selectattr('tunnels', 'defined') %} | ||
{% set name = network['name'] if 'name' in network else network['role'] %} | ||
{% set bridge_name = 'br-' + name %} | ||
|
||
config tunspace "tunspace" | ||
option uplink_netns "{{ name }}" | ||
option uplink_ifname "{{ bridge_name }}" | ||
option maintenance_interval 15 | ||
|
||
{% for tun in network['tunnels'] %} | ||
config wg-interface | ||
option ifname "{{ tun['ifname'] }}" | ||
option ipv6 "{{ tun['ipv6']|default('fe80::2/64') }}" | ||
option ipv4 "{{ tun['ipv4'] }}" | ||
option mtu {{ tun['mtu'] }} | ||
option port {{ tun['port'] }} | ||
option keyfile "/etc/tunspace/{{ tun['ifname'] }}.key" | ||
option disabled 0 | ||
|
||
{% endfor %} | ||
|
||
{% for gateway in groups['role_gateway'] %} | ||
config wg-server | ||
option name "{{ gateway }}" | ||
option url "https://{{ hostvars[gateway]['uplink']['ipv4'] | ansible.utils.ipaddr('address') }}/ubus" | ||
option check_cert 0 | ||
option disabled 0 | ||
|
||
{% endfor %} | ||
{% endfor %} |