Automated Raspberry Pi boot drive provisioning with cloud-init.
Platform Support: Currently macOS only. Uses
diskutilandddfor direct drive flashing. Linux and Windows support planned.Why not rpi-imager? Raspberry Pi Imager 2.0+ removed CLI support (
--cliflag), so we use directddflashing with platform abstractions for future cross-platform compatibility.
- macOS (Darwin)
- Python 3.12+
- uv (package manager)
- OpenSSL (for password hashing)
Package Manager: uv
Dependencies:
typer- CLI frameworkrich- Terminal formattinginquirerpy- Interactive promptsjinja2- Cloud-init template renderingpyyaml- Configuration loadingrequests- Image downloadsplatformdirs- Cross-platform cache directories
Architecture:
- Cloud-init based provisioning (Raspberry Pi OS Trixie+)
- Platform abstraction for future Linux/Windows support
- Direct drive flashing via
dd - Smart caching with hash verification
git clone <repository-url>
cd pitool
uv sync --devCreate pitool.yml:
raspberry_pis:
- name: pi
hostname: raspberrypi
wifi:
country_code: DE
ssid: "YourWiFiSSID"
password: "YourWiFiPassword"
user:
name: pi
password: "$6$salt$hashedpassword" # Use `pitool passwd` to generate
ssh_public_key: "ssh-ed25519 AAAA..."
timezone: Europe/Berlin
locale: en_US.UTF-8
update: true
upgrade: true
packages:
- ansible
reboot: trueSee pitool.example.yml for reference.
Generate password hash:
uv run pitool passwdFlash boot drive:
uv run pitool flash
# Clear download cache first
uv run pitool flash --clear-cacheConnect to Pi:
uv run pitool connectWaits for Pi to come online, removes old SSH host key, and connects via SSH.
Trust Pi's mkcert certificates:
uv run pitool trustDownloads and trusts the Pi's mkcert root CA certificate in your macOS keychain. Required for accessing Pi services with local HTTPS certificates. Restart your browser after installation.
Tooling:
Install Task:
brew install go-taskAvailable tasks:
# Install dependencies
task sync
# or
uv sync --dev
# Run CLI directly
task run -- flash
task run -- passwd
task run -- connect
task run -- trust
# Lint code
task check
# Format code
task formatSee Taskfile.yml for all available tasks.
MIT License - See LICENSE