In a Jinja2 template designed for Junos configuration, how do you correctly output the value of a variable named 'hostname'?
Double curly braces denote a Jinja2 expression, so `{{ hostname }}` substitutes the variable's value into the rendered Junos configuration. Single braces or bare names would be emitted literally, failing to satisfy the requirement to output the value.
Why this answer
Jinja2 uses double curly braces {{ }} as the expression delimiter to output the value of a variable into the rendered template. Writing {{ hostname }} substitutes the value of the 'hostname' variable at render time. This is the standard Jinja2 syntax for variable interpolation and is used throughout Junos configuration templates.
Exam trap
JNCIA-DevOps often tests the distinction between Jinja2's expression delimiter {{ }} and its statement delimiter {% %}, and candidates frequently swap them or use shell-style ${} syntax out of habit.
How to eliminate wrong answers
Option A is wrong because ${hostname} is shell/Perl-style variable interpolation, not Jinja2 syntax — Jinja2 does not recognize dollar-brace notation. Option B is wrong because {% hostname %} uses Jinja2's statement delimiter, which is reserved for control structures like if, for, and set, not for outputting variable values. Option C is wrong because << hostname >> is not valid Jinja2 syntax at all — it resembles heredoc or custom placeholder notation and would be rendered literally.