Review questions
Do you think you've understood the chapter well enough? Try answering the following questions to test your understanding:
- How are Jinja2 templates different from static files?
- What are facts? How are they discovered?
- What is the difference between
{{ }}
and{% %}
in the context of Jinja2 templates? - Can you use a variable anywhere apart from templates? If yes, where?
- If you define a variable
foo
in thevars
directory in a role and the same variable in thehosts_var
file, which of these will take precedence? - How do you write Ansible roles that are supported on multiple platforms?
- Where can you specify the author and licensing information in a role?
- How do you provide variables while launching an Ansible-playbook command?
- Which command would you use to create a directory structure required by the roles automatically?
- How do you override a variable specified in the
vars
directory of a role?