Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
add support for common interface options
Browse files Browse the repository at this point in the history
This adds support for 'common' options that are valid for all typeps of
logical interfaces as documented here:

https://openwrt.org/docs/guide-user/network/network_configuration#section_interface
  • Loading branch information
skrobul committed Dec 15, 2023
1 parent d275f30 commit 453a455
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions roles/ansible_openwrtnetwork/templates/functions.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@ config interface "{{ key }}"
option device "{{ value['device'] }}"
{% endif %}
option proto "{{ value['proto'] }}"
{% if value['mtu'] is defined %}
option mtu "{{ value['mtu'] }}"
{% endif %}
{% if value['ipv6'] is defined %}
option ipv6 "{{ value['ipv6'] }}"
{% endif %}
{% if value['force_link'] is defined %}
option force_link "{{ value['force_link'] }}"
{% endif %}
{% if value['disabled'] is defined %}
option disabled "{{ value['disabled'] }}"
{% endif %}
{% if value['ip4table'] is defined %}
option ip4table "{{ value['ip4table'] }}"
{% endif %}
{% if value['ip6table'] is defined %}
option ip6table "{{ value['ip6table'] }}"
{% endif %}
{% if value['proto'] == "wireguard" %}
option private_key "{{ value['wg_private_key'] }}"
{% if value['wg_listen_port'] is defined %}
Expand Down Expand Up @@ -353,9 +371,7 @@ config interface "{{ key }}"
{% endif %}
{% if value['proto'] == "ppp" %}
# PPP config
{% if value['ipv6'] is defined %}
option ipv6 "value['ipv6']"
{% else %}
{% if value['ipv6'] is not defined %}
option ipv6 "auto"
{% endif %}
{% if value['device'] is defined %}
Expand All @@ -370,9 +386,7 @@ config interface "{{ key }}"
{% endif %}
{% if value['proto'] == "pppoe" %}
# PPPoE config
{% if value['ipv6'] is defined %}
option ipv6 "value['ipv6']"
{% else %}
{% if value['ipv6'] is not defined %}
option ipv6 "auto"
{% endif %}
{% if value['username'] is defined %}
Expand Down

0 comments on commit 453a455

Please sign in to comment.