---
title: "Ansible: Configuration Management & Automation"
description: "Test your knowledge of Ansible fundamentals with a quiz covering playbooks, modules, inventory management, handlers, roles, and automation best practices."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/quizzes/post/ansible-automation-fundamentals-quiz
---

# Ansible: Configuration Management & Automation

Welcome to the Ansible Basics Quiz! This quiz covers fundamental Ansible concepts, modules, and best practices. Each question is multiple-choice, and you'll find hints to help you along the way. Good luck!

## Questions

### 1. Which command is used to execute an Ansible playbook?

- `ansible-run`
- `ansible-playbook`
- `ansible-apply`
- `ansible-execute`

**Hint:** It is a hyphenated command starting with the tool name.

### 2. What is the default file path for the Ansible inventory file?

- `/etc/ansible/hosts`
- `/etc/ansible/inventory`
- `/var/ansible/hosts`
- `/usr/ansible/inventory`

**Hint:** It is located in the /etc/ directory.

### 3. Which keyword defines the remote user Ansible uses for SSH connections?

- `user`
- `remote_user`
- `login_user`
- `ssh_user`

**Hint:** It is often set at the play level.

### 4. What is the primary purpose of the "become: yes" directive?

- Enable remote logging
- Enable privilege escalation
- Enable SSH key sharing
- Enable multi-user access

**Hint:** Think of the "sudo" command in Linux.

### 5. Which module is recommended for installing packages on RHEL-based systems?

- `apt`
- `dnf`
- `pkg`
- `rpm`

**Hint:** It is the successor to the "yum" module.

### 6. In Ansible, what is a "Fact"?

- A hard-coded variable
- System information gathered
- A task failure message
- An encrypted vault secret

**Hint:** Information gathered about the remote system.

### 7. Which module transfers files from the control node to the remote server?

- `move`
- `copy`
- `push`
- `fetch`

**Hint:** The name is very straightforward.

### 8. What does "Idempotency" mean in the context of automation?

- Increased execution speed
- Consistent state results
- Parallel task execution
- Secure data encryption

**Hint:** Run it once, run it ten times, the result is the same.

### 9. Which keyword allows a task to run only if a specific condition is met?

- `when`
- `only_if`
- `check`
- `match`

**Hint:** It works like an "if" statement.

### 10. Which tool is used to encrypt sensitive variables or files in Ansible?

- `ansible-crypt`
- `ansible-vault`
- `ansible-secret`
- `ansible-secure`

**Hint:** Think of a secure room for valuables.

### 11. Which module is used to ensure a service is running and enabled on boot?

- `systemd`
- `service`
- `daemon`
- `process`

**Hint:** The module name matches the Linux system manager.

### 12. What is the specific purpose of "Handlers" in an Ansible play?

- Handle execution errors
- Run tasks upon notification
- Define global variables
- Manage remote SSH keys

**Hint:** They only run if something has "changed".

### 13. Which file extension is standard for Ansible playbooks?

- `.json`
- `.yml`
- `.ans`
- `.cfg`

**Hint:** Yet Another Markup Language.

### 14. What does the "ansible_all_ipv4_addresses" variable represent?

- Control node IP list
- Target host IP list
- Cloud gateway IP list
- Subnet mask IP list

**Hint:** It is a type of "Fact".

### 15. Which flag validates playbook syntax without executing any tasks?

- `--check`
- `--syntax-check`
- `--validate`
- `--dry-run`

**Hint:** You are "checking" the "syntax".

### 16. Which module is designed to modify a single specific line in a file?

- `file`
- `lineinfile`
- `replace`
- `template`

**Hint:** It uses a "regex" (regular expression).

### 17. Which keyword is used to iterate over a list of items in a task?

- `repeat`
- `for_each`
- `loop`
- `iterate`

**Hint:** It replaced the older "with_items".

### 18. What is an Ansible "Role" in a production environment?

- User access level
- Reusable task structure
- Remote host type
- Privilege level flag

**Hint:** A way to bundle playbooks and files into a reusable package.

### 19. Which module executes commands through the remote shell environment?

- `command`
- `shell`
- `raw`
- `script`

**Hint:** It is generally discouraged in favor of specific modules.

### 20. What is the default SSH port Ansible uses for Linux connections?

- 80
- 443
- 22
- 5985

**Hint:** Standard SSH port.

### 21. Which file defines global settings like fork count and SSH timeouts?

- `ansible.cfg`
- `settings.yml`
- `ansible.ini`
- `hosts.cfg`

**Hint:** Found in /etc/ansible/ or the current directory.

### 22. What does the "register" keyword do within a task?

- Adds a new host
- Saves task output
- Defines a handler
- Encrypts a variable

**Hint:** Saves the output of a task for later use.

### 23. Which directive allows a playbook to continue if a task fails?

- `ignore_errors: yes`
- `on_failure: skip`
- `force: yes`
- `continue: yes`

**Hint:** Use this for tasks that might fail but aren't critical.

### 24. Which module manages file properties like permissions and ownership?

- `directory`
- `file`
- `chown`
- `attributes`

**Hint:** A very common Linux command name.

### 25. What is "Ansible Galaxy"?

- Cloud hosting provider
- Content repository hub
- System monitoring tool
- Variable encryption tool

**Hint:** A hub for sharing Ansible content.

### 26. How is a host group defined in an INI-style inventory file?

- `<group_name>`
- `[group_name]`
- `{group_name}`
- `group: group_name`

**Hint:** Use square brackets.

### 27. What characterizes "Ad-hoc mode" in Ansible?

- Advanced debugging mode
- Single task execution
- Parallel execution mode
- Windows-only access mode

**Hint:** Running a single command without a playbook.

### 28. Which module is used to create files from Jinja2 templates?

- `jinja`
- `template`
- `render`
- `format`

**Hint:** The name is exactly what it does.

### 29. What is the primary function of the "debug" module?

- Stopping execution flow
- Displaying variable values
- Fixing syntax errors
- Logging into systems

**Hint:** It prints information to the console.

### 30. What does the "Forks" setting control in Ansible?

- Ansible version count
- Parallel host connections
- CPU core requirements
- Playbook play count

**Hint:** Number of parallel processes.
