From b33323178af73c0e50b39cbbd5128bc5fbcbad35 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 17 May 2024 02:33:12 +0200 Subject: add cm4 based sensor nodes (base install) --- roles/installer/raspios/image/templates/firstrun.sh.j2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'roles/installer/raspios/image') 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 }} -- cgit v1.2.3