Ansible inventories, playbooks, modules, roles, variables, handlers, idempotency, Vault and Galaxy.
35 cards · basic cards · AI-written, checked twice. Edit anything.
- What is an Ansible inventory?
Show answer
A file listing all managed hosts and groups that Ansible can connect to and manage
- Where is the default Ansible inventory file located?
Show answer
/etc/ansible/hosts
- What is the INI format for Ansible inventory?
Show answer
A format using square brackets for group names and listing hosts line by line, optionally with key=value variables
- What is the YAML format for Ansible inventory?
Show answer
A hierarchical format using all as root, groups as keys with hosts sub-key containing host entries
- In Ansible, what is a group in an inventory file?
Show answer
A logical collection of hosts that can be targeted together in a playbook
- How do you specify a custom inventory file when running a playbook?
Show answer
Use the -i flag followed by the path: ansible-playbook -i /path/to/inventory playbook.yml
- What is an Ansible playbook?
Show answer
A YAML file containing one or more plays that define tasks to execute on managed hosts
- What are the main components of a playbook?
Show answer
Plays, which contain hosts to target and tasks to execute on those hosts
- In what order are tasks executed in an Ansible playbook?
Show answer
Sequentially from top to bottom, on all hosts before moving to the next task
- What does the hosts keyword specify in an Ansible play?
Show answer
The target hosts or group of hosts on which the play will execute tasks
- What is an Ansible module?
Show answer
A standalone script or program that performs a specific task, such as copying files or managing services
- What does it mean for an Ansible module to be idempotent?
Show answer
Running the module multiple times with the same parameters produces the same result without unintended changes
- What is the purpose of the Ansible copy module?
Show answer
To copy files from the control node to managed hosts
- What is the purpose of the Ansible service module?
Show answer
To manage system services, such as starting, stopping, or enabling services
- Is the Ansible command module idempotent?
Show answer
No, the command module runs the specified command every time, even if the result is unchanged