Ansible roles reference¶
ansible/playbook_testbed.yml installs components that complement the
upstream playbook_labgrid.yml. Each role maps to a tag so it can be run
independently.
Quick reference¶
| Role | Tag | Function | Pre-requisite | Post-check |
|---|---|---|---|---|
virtual_mesh |
virtual_mesh |
Builds vwifi from source, installs QEMU, loads mac80211_hwsim |
CMake, git, kernel headers | which vwifi-server, lsmod | grep mac80211_hwsim |
arduino_relay |
arduino |
Deploys arduino daemon, udev rule for /dev/arduino-relay, systemd service |
Arduino Nano connected | systemctl status arduino-relay-daemon |
poe_switch |
poe_switch |
Installs labgrid-switch-abstraction via pipx, deploys poe_switch_control.py |
Switch reachable via SSH | poe_switch_control.py status 1 |
wireguard |
wireguard |
Configures WireGuard SSH transport tunnel to openwrt-tests SSH gateway VM (global-coordinator hostname) |
Public key shared with gateway maintainer | wg show |
zerotier |
zerotier (via testbed) |
Installs ZeroTier and joins network 93afae5963ea9881 |
Node authorized at my.zerotier.com | zerotier-cli info |
wol |
wol |
Enables Wake-on-LAN on the host NIC at boot via systemd | Correct interface in wol_interface |
ethtool enp0s25 | grep Wake |
tftp_cleanup |
tftp_cleanup |
Systemd timer that prunes broken TFTP symlinks and orphan labgrid cache dirs | TFTP dir at /srv/tftp |
systemctl status tftp-cleanup.timer |
observability |
observability |
Prometheus node-exporter, autossh tunnels per DUT, Grafana dashboards | DUTs reachable, Oracle VPS configured | curl localhost:9100/metrics |
Running the playbook¶
# Full testbed provisioning
ansible-playbook -i ansible/inventory/hosts.yml ansible/playbook_testbed.yml -K
# Single role by tag
ansible-playbook -i ansible/inventory/hosts.yml ansible/playbook_testbed.yml \
--tags virtual_mesh -K
-K / --ask-become-pass is required because most roles install system packages
and manage systemd units.
Role details¶
virtual_mesh¶
Installs the QEMU + vwifi stack required for virtual mesh tests:
- Clones and builds vwifi with CMake
- Installs
qemu-system-x86,qemu-system-arm - Loads
mac80211_hwsimat boot (via/etc/modules-load.d/)
Key variable: none (no defaults file; package names are hardcoded for Ubuntu).
arduino_relay¶
- Deploys
scripts/arduino/arduino_daemon.pyto/usr/local/bin/ - Installs
configs/templates/arduino-relay-daemon.serviceto systemd - Writes a udev rule that creates
/dev/arduino-relaysymlink for the Arduino Nano's USB-serial adapter (matched by USB vendor/product ID) - Enables and starts the daemon
See Arduino relay for the channel map and CLI reference.
poe_switch¶
- Installs
labgrid-switch-abstractionviapipx - Copies
scripts/switch/poe_switch_control.pyto/usr/local/bin/ - Creates
~/.config/switch.conffrom theswitch_passwordvariable (set inansible/inventory/group_vars/all.ymlor passed via--extra-vars)
See PoE switch control for usage and troubleshooting.
wireguard¶
- Generates a WireGuard key pair on the host if one does not exist
- Renders
/etc/wireguard/wg0.conffrom a template with SSH gateway VM peer settings - Enables
wg-quick@wg0at boot
The lab's public key must be shared with the gateway VM maintainer (Aparcar)
to be authorized in the VM's wg0.conf. See
openwrt-tests onboarding.
zerotier¶
- Runs the official ZeroTier install script
- Joins network
93afae5963ea9881(admin-only remote access) - Node must be authorized manually at my.zerotier.com
wol¶
- Sets
WakeOnLan=magiconwol_interface(default:enp0s25) via a systemd network drop-in - Verifies with
ethtoolthat the NIC actually supports magic-packet WoL
The interface must match the host hardware. For the FCEFyN Lenovo T430
the interface is enp0s25.
See Wake-on-LAN setup.
tftp_cleanup¶
Systemd timer that runs daily and removes:
- Broken symlinks under
tftp_cleanup_tftp_dir(/srv/tftp) - Orphan labgrid cache dirs under
tftp_cleanup_cache_dir(/var/cache/labgrid) — directories with no referencing symlink and older thantftp_cleanup_retention_daysdays (default 30)
Key defaults (ansible/roles/tftp_cleanup/defaults/main.yml):
tftp_cleanup_tftp_dir: /srv/tftp
tftp_cleanup_cache_dir: /var/cache/labgrid
tftp_cleanup_retention_days: 30
tftp_cleanup_schedule: "daily"
tftp_cleanup_dry_run: false
Set tftp_cleanup_dry_run: true to validate on a fresh host before
enabling real deletions.
observability¶
- Installs and starts
prometheus-node-exporteron the orchestration host - Creates
autosshsystemd units that maintain reverse SSH tunnels from each DUT to a local port (19100–19105) for metrics scraping - Deploys Grafana dashboard provisioning files
See Observability for the full monitoring stack.
See also¶
- Ansible / Labgrid — upstream
playbook_labgrid.yml(exporter, places, SSH keys) ansible/playbook_testbed.yml— playbook source with per-role tag comments