Some Ansible playbooks to manage PiBox.io devices instead of using kubesail.com
.vscode | ||
ansible | ||
.editorconfig | ||
.gitignore | ||
license.txt | ||
readme.md | ||
requirements.txt |
pibox-ansible
Some ansible playbooks to manage a pibox in various ways
Prerequisites
- Internet connection
- Python 3 on Linux (or WSL)
- One or more PiBoxes that you don't want to manage through KubeSail
- I recommend installing the latest version before proceeding
- Note: There is a bug where the ssh server won't start. Fix outlined below.
- I recommend installing the latest version before proceeding
Getting Started
- Clone this repository:
git clone https://c0de.dev/c0de/pibox-ansible
- Enter the repo:
cd pibox-ansible
- Create a python virtual environment:
python3 -m venv .venv
- Enter the virtual environment:
source .venv/bin/activate
- (optional) Upgrade PIP:
pip3 install --upgrade pip
- Install ansible:
pip3 install -r requirements.txt
- Configure inventory
- You probably don't have my domain name on your network lol
- Ping your hosts:
ansible -i ansible/inventories/inventory.yml all -m ping
- If you can't resolve any hosts, check DNS. It's always DNS.
- Proceed to running playbooks
Running Playbooks
It's recommended to use play.sh
as it will automatically create log files for the playbooks that you execute.
Its usage is: ./play.sh <playbook-name>
Fixing no SSH on latest version
During install of the custom image, pi flasher
allowed me to configure things like the hostname, ssid, my ssh key, my user account. This sets up a script that runs when the pi reboots for the first time after install.
- Mount the pi's
/boot
volume (it should be in your file manager somewhere) - Edit the
initial-boot.sh
(or similar named script) - Add
ssh-keygen -A
somewhere in the file - Save and close the file
- Safely unmount the pi's
/boot
- Done! The ssh server is now functional
Alternatively, you can wait for the system to boot with a keyboard and monitor connected and:
- login;
- open a terminal;
- run
sudo ssh-keygen -A
; - then
sudo systemctl enable --now ssh
.