Skip to Content

Open Source Server Stack — Guide 9: deploying a server with Ansible

A working slave VPS in 15 minutes

You built your first VPS by hand with Guide 1. It took hours. Now you want a second one. Redo everything manually? 3-5 hours, the risk of forgetting a step, no guarantee of consistency between servers.

This guide automates everything with Ansible. One command. 11 roles. A secure slave VPS, connected to the VPN, monitored, backed up.

What the playbook does in one command

  • Creates your admin user, copies the SSH keys, removes the default user
  • UFW, Fail2ban, Docker, automatic updates
  • WireGuard tunnel to the master
  • Monitoring: node-exporter + cAdvisor + Alloy → your existing Grafana
  • Caddy (TLS reverse proxy, if the VPS is public)
  • sops/age secrets (decrypted at boot)
  • Daily encrypted Restic backup to the master over the VPN

The 11 Ansible roles

base · firewall · fail2ban · docker · auto-updates · wireguard-slave · monitoring-slave · caddy · sops · nodejs · restic-slave

Everything is conditional: enable or disable each role per VPS through a YAML variables file.

After this guide

Adding a VPS = editing a YAML file + running one command. Reproducible, auditable, idempotent. Every server is identical.

What you get

  • The complete guide (PDF + Markdown)
  • 3 appendices: Backing Up Remote VPS Servers via the Master, Adding a Server to Monitoring, Linux Commands
  • 12 configuration files: Ansible playbook, inventory template, host_vars template, slave monitoring docker-compose, Alloy and Prometheus configs, Restic backup scripts, crons, systemd service

This guide complements the Open Source Server Stack series

An extension for those who manage multiple servers. Prerequisite: Guide 1 (a working master VPS). To build your first Jarvis: Guides Pack (CHF 149) or Complete Pack (CHF 249).

By Myrko Federico — Swiss systems engineer, 25 years of experience.

Format: PDF + Markdown + 12 configuration files — Estimated time: 1-2 hours (first VPS), 15 min afterwards

Infrastructure AI
CHF 39.00 CHF 39.00

Terms and Conditions
30-day money-back guarantee
Shipping: 2-3 Business Days