Some Ansible playbooks to manage PiBox.io devices instead of using kubesail.com
Go to file
c0de 94e6d890a8 Add script to run playbooks 2024-01-04 15:37:57 -06:00
.vscode install ansible-lint 2024-01-03 23:21:25 -06:00
ansible Add script to run playbooks 2024-01-04 15:37:57 -06:00
.editorconfig Initial Commit 2024-01-03 23:16:05 -06:00
.gitignore ignore logs 2024-01-04 14:50:07 -06:00
license.txt rename license file to lowercase for consistency 2024-01-04 13:41:15 -06:00
readme.md Add script to run playbooks 2024-01-04 15:37:57 -06:00
requirements.txt install ansible-lint 2024-01-03 23:21:25 -06:00

readme.md

pibox-ansible

Some ansible playbooks to manage a pibox in various ways

Prerequisites

  1. Internet connection
  2. Python 3 on Linux (or WSL)
  3. One or more PiBoxes that you don't want to manage through KubeSail

Getting Started

  1. Clone this repository: git clone https://c0de.dev/c0de/pibox-ansible
  2. Enter the repo: cd pibox-ansible
  3. Create a python virtual environment: python3 -m venv .venv
  4. Enter the virtual environment: source .venv/bin/activate
  5. (optional) Upgrade PIP: pip3 install --upgrade pip
  6. Install ansible: pip3 install -r requirements.txt
  7. Configure inventory
    • You probably don't have my domain name on your network lol
  8. 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.
  9. 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.

  1. Mount the pi's /boot volume (it should be in your file manager somewhere)
  2. Edit the initial-boot.sh (or similar named script)
  3. Add ssh-keygen -A somewhere in the file
  4. Save and close the file
  5. Safely unmount the pi's /boot
  6. 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.