Chapter 11: Comprehensive Review
Ansible final review quiz
Twenty questions across the whole course, roughly in chapter order. Aim for at least sixteen. For every one you miss, the explanation names the idea to go back to.
- Which file does Ansible use when there is an `ansible.cfg` in the current directory, one in your home directory as `~/.ansible.cfg`, and `/etc/ansible/ansible.cfg`?
- In this inventory, which hosts does the pattern `webservers` select?
- Which ad hoc command is safe to repeat, reporting no change the second time?
- A playbook loads a vaulted file with `vars_files`. How do you run it without typing the password?
- Which of these is a magic variable rather than a fact?
- A variable is set in `group_vars/all`, in `group_vars/web`, and in the play’s `vars`. Which value does a task in that play see on a host in web?
- This task runs on four hosts. What happens?
- Three tasks notify the same handler, and two of them change something. How often does the handler run?
- A task must fail only when the command output contains "ERROR". What do you add?
- Which module sets a file’s SELinux type persistently, so that a relabel keeps it?
- Inside a role, a template task says `src: index.html.j2`. Where does Ansible look first?
- Which pattern selects the hosts that are in both web and prod?
- What is the difference between `import_tasks` and `include_tasks`?
- Where should a role put a value that users of the role are expected to change?
- You run `ansible-galaxy collection install -r` with this file. What happens?
- A run stops with "Missing sudo password". What is the most likely cause?
- What does `--check --diff` show?
- How do you add a sudo rule without risking a broken sudoers file?
- Which task mounts a file system now and also on every boot?
- A playbook finishes with `failed=0`. What does that prove?