Ansible templates and handlers, by example
Render an nginx config from a Jinja2 template, notify a handler so it reloads only on a real change, then run the play twice to prove idempotence.
Filtering by topic #ansible · clear
Render an nginx config from a Jinja2 template, notify a handler so it reloads only on a real change, then run the play twice to prove idempotence.
Ansible check mode explained: what --check and --diff really prove, and where a dry run gives you a wrong answer before you apply for real.
Your Ansible inventory decides which host gets which variable: INI and YAML forms, groups, group_vars, host_vars, connection settings and precedence.
Keep passwords and API tokens in a playbook repo safely: encrypt a vars file or one inline string, split staging from production, and rekey cleanly.
Ansible treats an unreachable host differently from a failed task. Use ignore_unreachable, serial and max_fail_percentage, and still see what was missed.
Terraform creates the VPS, Ansible configures it. The real split, why provisioners fight both tools, the handoff commands, and when you need only Ansible.
When a flat Ansible playbook is enough and when a role earns its directories: the role layout, ansible-galaxy init, role calls, and variable precedence.
SSH config, tmux, Ansible, Uptime Kuma, Zabbix and Webmin, ranked by how many servers you have: what each replaces, setup cost in minutes, the one gotcha.
Install Ansible with pipx on Ubuntu 24.04, write an inventory and a first playbook that hardens a fresh VPS, plus fixes for Permission denied and sudo errors.