Ansible vs Terraform for VPS fleets
December 11, 2024 ยท 10 min read
This post collects practical notes accumulated while working on real systems. Code samples are simplified for clarity; production setups usually need additional hardening, monitoring, and backup tested with a periodic restore drill.
Overview
The setup described below assumes a Debian/Ubuntu LTS host with systemd and a stable kernel. Other distributions work with minor adjustments to package names and paths.
sudo systemctl status nginx
sudo journalctl -u nginx --since "1 hour ago" --no-pager
Implementation
Apply the configuration changes incrementally. After each change, validate before reloading the service. This prevents downtime caused by typos and missing directives.
sudo nginx -t \
&& sudo systemctl reload nginx \
|| echo "config invalid, not reloading"
Takeaways
- Keep configuration in version control
- Automate certificate renewal and reload hooks
- Monitor service availability and key error patterns
- Test backups by restoring them
โ Last updated December 11, 2024