Skip to content

davidlsq/installer

Repository files navigation

installer

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-server

Try it with a virtual machine

Build a minimal iso with ssh server :

make virtual/virtual.iso

Tested on arm64 macOS with UTM and apple virtualization :

virtual image install step 1

Select the install entry at first boot :

virtual image install step 2

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.local

Detailed build steps

For the infra/raspi and infra/server machines

Local prepare

Fetch some static secrets from bitwarden :

make infra/config/bitwarden.yml

Generate dynamically other secrets and configurations files (linux user password, ssh keys, wireguard keys, ...) :

make infra/config/playbook

Build rasperry image and debian iso

make infra/raspi.img
make infra/server.iso

The 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

Post install

Add the ssh configuration to connect to the machines :

echo "Include $(pwd)/infra/config/playbook/ssh_client" >> ~/.ssh/config

ssh server.local
ssh raspi.local

Some other features

Bitwarden push

To push the dynamically generated secrets to bitwarden :

make bitwarden-push

Run the ansible playbooks

To update the home infrastructure machines without reinstalling everything with the images :

make playbook-check
make playbook

Also used in github actions to run a playbook check run on PR code and a playbook run after merge

Auto update

A github action runs periodically to check the current software versions and creates PRs to update if needed

Some alternatives

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

About

Manage server

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •