provision image through Terraform

This commit is contained in:
2025-04-22 14:09:27 +02:00
parent e7a3587501
commit 2304a5f7c7
9 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Generate a unique hostname
NEW_HOSTNAME="rpi-$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2 | tail -c 5)"
echo "$NEW_HOSTNAME" > /etc/hostname
sed -i "s/raspberrypi/$NEW_HOSTNAME/g" /etc/hosts
hostname "$NEW_HOSTNAME"