Chapter 7: Managing Complex Plays and Playbooks
Ansible complex playbooks quiz
Twelve questions on host patterns, imports and includes. Aim for at least nine before moving on to chapter 8.
- A host is listed in the inventory as `web1.example.com`. Its IP address is 192.0.2.10 and it is not listed by address. What does `hosts: 192.0.2.10` select?
- Which hosts does `'web,db,!staging'` select?
- Which pattern is equivalent to `'web,&production'`?
- The inventory has a group `prod` and a host `prod-db1`. What does `prod*` match?
- What does `web[0]` select?
- A playbook has two plays, for `web` and for `db`. You run it with `--limit web`. What happens to the second play?
- What is wrong with this playbook?
- Which statement about `import_tasks` is true?
- An `include_tasks` has `when: install_db` and the variable is false. How many tasks from the file appear in the output?
- You want the task file to be chosen by a fact: `tasks/setup-{{ ansible_facts['os_family'] }}.yml`. Which keyword works?
- How do you give a task file a different package list each time it is used?
- A task in an included file has `notify: restart httpd`. Where must that handler be defined?