Skip to content

fabio-rinaldo/piledbox-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible deployment for piledbox

This repo contains Ansible playbooks for automated provisioning and deployment of piledbox to Raspberry Pi 5 units.

Project repo: https://github.com/fabio-rinaldo/piledbox.git

Playbooks

The following playbooks are provided:

  1. playbooks/make-sd-card.yaml: Downloads Raspberry Pi OS image, burns it to SD card, and pre-configures it

  2. playbooks/rpi-deploy.yaml: Connects to a Raspberry Pi via SSH to configure it and deploy piledbox

  3. playbooks/rpi-update.yaml: Connects to a Raspberry Pi via SSH to update piledbox to the latest version

Prerequisites

On your local machine (control node) you need the following installed:

  • ansible
  • sshpass (for initial SSH authentication with password)
  • rpi-imager CLI tool for RPi microSD card imaging

Install prerequisites:

# Debian/Ubuntu
sudo apt install ansible sshpass rpi-imager

As well as of course a microSD card reader.

How to use

1. Configure variables (optional)

Edit inventory/group_vars/all.yaml if you wish to configure:

  • RPi locale settings
  • RPi administrator user name

2. Set up secrets

Create secrets file from the template:

cp inventory/host_vars/imager/secrets.yaml.template inventory/host_vars/imager/secrets.yaml

Edit it with your desired wifi credentials and hashed admin user password.

Generate a new hashed password with:

mkpasswd -m yescrypt

3. piledbox configuration file

Create a piledbox configuration file from the template:

cp roles/server/files/config.yaml.template roles/server/files/config.yaml 

Edit config.yaml to suit your installation. This file will be deployed to the Raspberry Pi.

4. Burn microSD card

This playbook prepares a bootable SD card with Raspberry Pi OS (Trixie), pre-configured with locale settings, WiFi, SSH, and user accounts.

ansible-playbook playbooks/make-sd-card.yaml -K

You will be asked for your local user sudo password (required to flash the microSD card).

Then follow the on-screen instructions.

5. After imaging:

  • Unmount the SD card
  • Insert into Raspberry Pi and power on
  • Wait ~2 minutes for first boot and cloud-init to complete
  • The Pi should connect to your WiFi network automatically

6. Deploy to RPi

Run this playbook to connect to the Raspberry Pi via SSH, configure it and deploy piledbox.

Prerequisites:

  • microSD card prepared with previous playbook
  • Raspberry Pi powered on and connected to network
ansible-playbook playbooks/rpi-deploy.yaml -K -k

You will be asked to enter the RPi administrator user password.

Then follow the on-screen instructions.

Note: You may be prompted to reboot the Pi during deployment to apply some changes.

7. Update piledbox

If you wish to update piledbox to its latest release, run the following:

ansible-playbook playbooks/rpi-update.yaml -K -k

Administration

You can SSH into the RPi as the admin user.

This workflow deploys the following:

  • set RPi hostname to piledbox.local
  • user piledbox to run the systemd service
  • group piledbox
  • adds user admin to group piledbox
  • app configuration file stored in /etc/piledbox/config.yaml
  • installs piledbox for both users admin and piledbox
  • systemd service piledbox
  • systemd timer piledbox-boot to start service 30 seconds after boot

You can start/stop the app manually via systemctl:

sudo systemctl start piledbox
sudo systemctl stop piledbox

About

Ansible deployment tools for piledbox

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages