AWS DevOps Engineer Professional DOP-C01 – Question452

Which is the proper syntax for referencing a variable's value in an Ansible task?

A.
${variable_name}
B. { variable_name }
C. "{{ variable_name }}"
D. @variable_name

Correct Answer: C

Explanation:

Explanation:
We use the variable’s name to reference the variable which we encapsulate in curly brackets `{{ }}’; however, the YAML syntax dictates that a string beginning with a curly bracket denotes a dictionary value.
To get around this, it is proper to wrap the variable declaration in quotes.
Reference:
http://docs.ansible.com/ansible/playbooks_variables.html#hey-wait-a…