Automation · Templates
Configuration Templates
Cheat sheet · https://pcornel.dk/topic.php?topic=5812
Answer
Configuration templates generate full device or service configs, such as a switch config or nginx.conf, from a base template plus per-device variables.
Remember
- A base template plus per-device variables produces full configs.
- Render one config per device.
- Validate before deploying.
First checks
ansible-playbook render.yml --check --diff— preview rendered configs- Templates per platform/role — structure
- Validation command (e.g. nginx -t, sshd -t) — syntax check
Commands
python -c "from jinja2 import Environment; Environment().parse(open('<template.j2>').read())"- Read-only/validation observation for whether the selected Jinja2 template parses successfully.
Verify in this order
data → template → config → validate → deploy
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5812