0Pricing
Ansible Academy · Lesson

The {{ }} Substitution Syntax

Inject variables into strings and args.

Meet Jinja2

The double curly braces come from Jinja2, the templating engine Ansible uses. Anything inside them is an expression to evaluate. 🌟

The Basic Substitution

At its simplest, {{ name }} is replaced with the value of name. Ansible evaluates it before the module runs.

msg: "Welcome, {{ name }}!"

All lessons in this course

  1. Defining & Using vars in a Play
  2. The {{ }} Substitution Syntax
  3. Extra Vars on the Command Line
  4. Where Variables Come From & Precedence
← Back to Ansible Academy