summaryrefslogtreecommitdiff
path: root/roles/installer/raspios/image/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/installer/raspios/image/templates')
-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 }}