Chapter 6: Deploying Files to Managed Hosts
Ansible files and templates quiz
Twelve questions on the file modules and Jinja2 templates. Aim for at least nine before moving on to chapter 7.
- Which module sets the owner, mode and SELinux type of a file that already exists, without touching its content?
- What does this task do if `/etc/app.conf` already exists with different content?
- Two hosts each have `/var/log/secure`. With `dest: backups` and the default `flat: false`, where does servera’s copy go?
- Which value gives `rw-r-----`?
- A `lineinfile` task has `regexp: '^PermitRootLogin'` and `line: PermitRootLogin no`. The file has no line starting with PermitRootLogin. What happens?
- What makes `blockinfile` idempotent?
- Which expression is true when a registered `stat` result found the file?
- How do you set a file’s SELinux context back to what the policy defines?
- What appears in the deployed file for this template line?
- Which module deploys a Jinja2 template?
- What does this template produce for `users: [root, jane, joe]`?
- Which filter writes a variable as indented, human-readable YAML?