intermediate~4h
Variables and Templates
How Ansible variables are scoped and layered, how Jinja2 templating drives per-environment configuration files, and a worked example templating an nginx config across environments.
Learning objectives
- Distinguish host vars, group vars, and role defaults by precedence
- Write Jinja2 expressions and control structures inside a template
- Template a config file that differs correctly across environments
- Debug variable values with the debug module
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.
Variables and Templates