pi-router is an Ansible project that turns a Raspberry Pi 5 into a small, self-managing LTE gateway. The Pi takes its uplink from a USB LTE modem, hands out internet to anything plugged into its Ethernet port, and stays reachable for remote SSH through Twingate. A UPS HAT on top keeps it running through power cuts and brings it back on its own when mains power returns.

The whole thing is driven from a single playbook. Bootstrap a fresh Pi, drop in a secrets.yml, run the playbook, and the device comes up configured the same way every time.

What it does

gsm TUI showing signal strength, level, best/worst tracker, network, status and band

battery command output showing voltage, current, source AC and charging status

Slack messages from the device: AC off at 12:00 with battery state, then AC on a minute later showing it has resumed charging

speed command output showing download and upload throughput with data used

Two daily speedtest summaries posted to Slack on consecutive days, showing min/avg/max for download, upload and ping

How it’s organised

The playbook is split into roles, each independently runnable with --tags:

Why it exists

I needed a router for a garage that has no fixed-line internet and unreliable mains power. A Raspberry Pi with an LTE HAT and a battery HAT covers both problems for less than the cost of a commercial 4G router, and the result is a single repo I can re-deploy onto a new Pi in a few minutes if anything goes wrong.

Source code

pi-router is open source. The full source — playbook, roles, templates, and the Python scripts for the UPS monitor and signal TUI — lives at github.com/andrzejsiemion/pi-router.