nolte / infra-golden-image

Creates a Base Image for different armhf Devices, like Raspberry-pi.
0 stars 0 forks source link

Personalized Images

This Repo will be help creating you own baseline. At the Moment the Focus will be, build Images for your Home Lab Cluster.

This Process will be make it Possible work with a set of different Distributions. You have the most Important Configurations for starting your device like Network Configurations (WLAN) or handle the Technical User for maintenance.

For the arm image creation we use the solo-io/packer-plugin-arm-image Packer Plugin.

Features

Different Distributions like:

Base Config Settings

Tested Devices

Device Arch hypriot raspbian (buster) raspbian (bullseye)
raspberry-pi-4 armhf :heavy_check_mark: :heavy_check_mark: :question:
Cubox-I 4x4 armhf :question: :question: :question:

How to Use

This Repo holds sources for crating Images used Packer (like src/packer/hypriot) , and some Ansible Sources (src/ansible/sd-card) for flashing the generated Images to some SD Card.

  1. Generate your personal Image, by using Packer
cd src/packer

# create a hypriot based image
# The container will be create a img, prepared for flash to your SD Card

docker run \
  --rm \
  --privileged \
  -w /build/hypriot \
  -v /dev:/dev \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-image:/build/output-image \
  -e PACKER_CACHE_DIR=/build/packer_cache \
  ghcr.io/solo-io/packer-plugin-arm-image build \
    -var local_ssh_public_key="$(pass private/keyfiles/ssh/private_ed25519/id_ed25519.pub)" \
    -var wifi_ssid=$(pass private/wlan/home/ssid) \
    -var wifi_psk=$(pass private/wlan/home/psk) \
    .

or some raspbian based image

docker run \
  --rm \
  --privileged \
  -w /build/raspbian \
  -v /dev:/dev \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-image:/build/output-image \
  -e PACKER_CACHE_DIR=/build/packer_cache \
  ghcr.io/solo-io/packer-plugin-arm-image build \
    -var ssh_public_key="$(pass private/keyfiles/ssh/private_ed25519/id_ed25519.pub)" \
    -var wifi_ssid=$(pass private/wlan/home/ssid) \
    -var wifi_psk=$(pass private/wlan/home/psk) \
    .
  1. Copy the Image to somme sd Card, with ansible.
# Move to the Playbook Folder
cd src/ansible/sd-card

# Copy the Image to given SD Card
docker run \
   --device=/dev/sda \
   --privileged \
   -w /workspace \
   -v $(pwd):/workspace \
   -v ${PWD}/../../packer/output-image:/tmp/img:ro \
   --rm ansible/ansible-runner \
   ansible-playbook main.yml --extra-vars "os_hostname=flasher os_prepared=hypriot sd_card_image=/tmp/img/custom-hypriotos.img"

# or the raspbian image

docker run \
   --device=/dev/sda \
   --privileged \
   -w /workspace \
   -v $(pwd):/workspace \
   -v ${PWD}/../../packer/output-image:/tmp/img:ro \
   --rm ansible/ansible-runner \
   ansible-playbook main.yml --extra-vars "os_hostname=flasher os_prepared=raspbian sd_card_image=/tmp/img/custom-raspbian.img"
  1. Start the Device, now you can connect by using the Private key for your SSH connection and then you can Configuration the node.