summaryrefslogtreecommitdiff
path: root/dan
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2023-03-05 17:11:40 +0100
committerChristian Pointner <equinox@spreadspace.org>2023-03-05 17:11:40 +0100
commita132f2af1e2ccf93dd6478672fa008d3fd298e32 (patch)
tree3a25cd548a4bed225431f721136e4ff9dfc1466a /dan
parentpix.elevate.at: increase disk quota (diff)
elevate/dione: add vlan interface for lan
Diffstat (limited to 'dan')
-rw-r--r--dan/ele-dione.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/dan/ele-dione.yml b/dan/ele-dione.yml
index eab42550..c486fc08 100644
--- a/dan/ele-dione.yml
+++ b/dan/ele-dione.yml
@@ -45,3 +45,32 @@
{{ module }}
{% endfor %}
dest: /etc/modules-load.d/sensors.conf
+
+ ## TODO: move to network/interfaces when this is done
+ - name: install vlan interfaces
+ loop: "{{ network.vlans | dict2items }}"
+ loop_control:
+ label: "{{ item.key }} ({{ item.value | join(',') }})"
+ copy:
+ dest: "/etc/network/interfaces.d/{{ item.key }}"
+ content: |
+ auto {{ item.key }}
+ iface {{ item.key }} inet manual
+ {% for vlan in item.value %}
+ {% set vlan_ifname = item.key + '.' + (vlan | string) %}
+ {% set vlan_iface = (network.interfaces | selectattr('name', 'eq', vlan_ifname)) %}
+
+ auto {{ vlan_ifname }}
+ {% if vlan_iface %}
+ iface {{ vlan_ifname }} inet static
+ address {{ (vlan_iface | first).address }}
+ {% for route in vlan_iface[0].static_routes | default([]) %}
+ up /bin/ip route add {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
+ {% endfor %}
+ {% for route in vlan_iface[0].static_routes | default([]) | reverse %}
+ down /bin/ip route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
+ {% endfor %}
+ {% else %}
+ iface {{ vlan_ifname }} inet manual
+ {% endif %}
+ {% endfor %}