Collection of scripts to build images installing all the softwares needed by the machines from my home infrastructure :
- a raspberry
- a debian server
Using Nix :
# prepare the build env
nix-shell
# fetch my secrets from bitwarden
make infra/config/bitwarden.yml
# build the raspberry image
make infra/raspi.img
# copy the image into a SD card
make dd-raspi
# build the server debian iso
make infra/server.iso
# copy the iso into a USB stick
make dd-serverBuild a minimal iso with ssh server :
make virtual/virtual.isoTested on arm64 macOS with UTM and apple virtualization :
Select the install entry at first boot :
Nothing more, after the debian installation the machine reboots to the system and run the ansible playbook installing everything
After some minutes :
ssh -F virtual/config/playbook/ssh_client david@virtual.localFor the infra/raspi and infra/server machines
Fetch some static secrets from bitwarden :
make infra/config/bitwarden.ymlGenerate dynamically other secrets and configurations files (linux user password, ssh keys, wireguard keys, ...) :
make infra/config/playbookmake infra/raspi.img
make infra/server.isoThe modified image and iso contains :
- the secrets used by the machine
- the configuration to install everything automatically (debian preseed or bash script for raspberry)
- ansible playbook and roles runnning at first boot
Add the ssh configuration to connect to the machines :
echo "Include $(pwd)/infra/config/playbook/ssh_client" >> ~/.ssh/config
ssh server.local
ssh raspi.localTo push the dynamically generated secrets to bitwarden :
make bitwarden-pushTo update the home infrastructure machines without reinstalling everything with the images :
make playbook-check
make playbookAlso used in github actions to run a playbook check run on PR code and a playbook run after merge
A github action runs periodically to check the current software versions and creates PRs to update if needed
With less code, I could have more or less the same features (auto-install, configuration by code) by using NixOs the linux distribution instead of debian
With no code at all, I could use UNRAID

