fabbr@site:~/projects/magellan/infra$

infra

# ~/projects/magellan/infra.yml
infra:
  status: active
  started: 2026-09-23
  tags: [opentofu, ansible, grafana, oracle-cloud]

magellan-infra runs what the other two repositories build. OpenTofu creates an Oracle Cloud VM, the compute I had at hand and plenty for this MVP, and Ansible configures both hosts from one inventory: a Raspberry Pi 2 B that runs magellan-device, and the VM that runs Grafana. Every host joins a private tailnet for SSH.

Oracle VMboardcreatesconvergesconvergesTofuAnsibledeviceserviceCaddyGrafanaCloudflare

The repository is separate because it holds what the code repositories shouldn’t: addresses, the inventory and the encrypted vault. So it stays private while magellan-device and magellan-cloud can be public, and a host change never shares a commit with a code change.

Alongside Grafana, it’s also the piece that has to know every other one. Deploying magellan-device needs the binary’s configuration, provisioning Grafana’s dashboards needs the cloud’s API and what each metric means, and both hosts need their own provisioning and deployment. In that sense it’s the hub of Magellan in code, the way the overview page is in prose.

How it got here

This project is what pushed my Ansible collection, ansible-infra, to manage single-board computers as well as VMs. Since 2026-09-29 it runs both the Pi and the VM, each with its own roles.

The VM is an E2.1.micro with 1 GB of memory and swap added, and it’s enough for one Grafana. At first Grafana was reachable only on the tailnet. On 2026-10-04 I moved it behind Cloudflare, partly because I’d just bought a domain, mostly because I wanted to open it from my phone. The OpenTofu configuration opens port 443 in the VM’s security list only to Cloudflare’s address ranges, and the VM’s iptables accept it, so nothing reaches Grafana except through Cloudflare; SSH goes over the tailnet. Caddy serves Grafana behind it and trusts the forwarded client address only from Cloudflare.

Rolling out the device

magellan-device ships as a release binary, and this repository pins its version. A rollout is a version bump and a converge: Ansible installs the new binary and systemd restarts it, while the batches already in the buffer wait on flash and drain once it’s back. Five releases went out this way, from v0.2.0 on 2026-09-24 to v0.6.0 on 2026-10-08, and the readings kept flowing through every one.

How it’s checked

Golden renders compare each role template’s output with a stored copy, so a template change shows up as a diff before it reaches a host. After a converge, a read-only check probes each host: on the Pi, that magellan-device’s buffer directory is in place; on the VM, that Grafana loaded the Magellan datasource and its alert rules, and that root logs in by key only.

Decisions

  • A host runs magellan-device or Grafana because of the inventory group it’s in, so a new board is an inventory entry and its vault.
  • I reach every host, the Pi and the VM alike, over the tailnet, and the shared baseline hardens sshd.
  • Secrets live in an encrypted Ansible vault.
  • A second converge reports no changes, so a converge can run again at any time.