summaryrefslogtreecommitdiff
path: root/roles/installer
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-05-17 02:33:12 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-05-17 02:33:12 +0200
commitb33323178af73c0e50b39cbbd5128bc5fbcbad35 (patch)
tree8194f22074bab5aa6cbc13285991dc7b23e300df /roles/installer
parentbase install for gstreamer decklink tests (diff)
add cm4 based sensor nodes (base install)
Diffstat (limited to 'roles/installer')
-rw-r--r--roles/installer/raspios/image/templates/firstrun.sh.j214
1 files changed, 14 insertions, 0 deletions
diff --git a/roles/installer/raspios/image/templates/firstrun.sh.j2 b/roles/installer/raspios/image/templates/firstrun.sh.j2
index 318b17dd..96c74b39 100644
--- a/roles/installer/raspios/image/templates/firstrun.sh.j2
+++ b/roles/installer/raspios/image/templates/firstrun.sh.j2
@@ -52,7 +52,21 @@ iface {{ network.primary.name }} inet static
up echo 0 > /proc/sys/net/ipv6/conf/\$IFACE/autoconf
address {{ network.primary.address | ansible.utils.ipaddr('address') }}
netmask {{ network.primary.address | ansible.utils.ipaddr('netmask') }}
+{% if 'gateway' in network.primary %}
gateway {{ network.primary.gateway }}
+{% endif %}
+{% for address in network.primary.additional_addresses | default([]) %}
+ up /bin/ip addr add dev $IFACE {{ address }}/32
+{% endfor %}
+{% for route in network.primary.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 network.primary.static_routes | default([]) | reverse %}
+ down /bin/ip route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %}{{ '' }}
+{% endfor %}
+{% for address in network.primary.additional_addresses | default([]) | reverse %}
+ down /bin/ip addr del dev $IFACE {{ address }}/32
+{% endfor %}
{% endif %}
{% if 'wifi' in network.primary %}
wpa-ssid {{ network.primary.wifi.ssid }}