Ansible Basics Quiz
← Back to Quiz Home
Validation of fundamental Ansible concepts.
Which command is used to run a playbook?
ansible-playbook is the command to execute Ansible playbooks. ansible is for ad-hoc commands.
What is the default location for the Ansible configuration file?
Ansible looks for the configuration file in /etc/ansible/ansible.cfg by default, though it can be overridden.
Which file is used to define the hosts and groups of hosts upon which commands, modules, and tasks in a playbook operate?
The inventory file (often located at /etc/ansible/hosts) defines the managed nodes.
Ansible uses which protocol to connect to Linux nodes by default?
Ansible is agentless and uses OpenSSH for transport.
What language are Ansible Playbooks written in?
Playbooks are expressed in YAML format because it is easier for humans to read and write.
Which module is used to check connectivity to target hosts?
The ping module tries to connect to the host, verify a usable python, and return pong on success.
How do you check the syntax of a playbook without executing it?
--syntax-check only validates the structure and parser of the playbook.
What is a "Task" in Ansible?
A task sends a module to the remote node to perform a specific action.
Which keyword is used to elevate privileges (e.g., sudo)?
become: yes is the directive to execute operations with privilege escalation (default is sudo).
Which of the following is NOT a valid Ansible variable scope?
Ansible variables have Global, Play, and Host scopes. "Thread scope" does not exist in this context.
What is the purpose of the -i flag in Ansible commands?
-i allows you to point to a specific inventory file instead of the default /etc/ansible/hosts.
Which module is used to manage packages on RedHat-based systems?
yum or dnf are the package managers for RHEL/CentOS. apt is for Debian/Ubuntu.
What is an Ansible "Role"?
Roles facilitate reuse and modularity by organizing related content.
What command allows you to see the documentation for a module?
ansible-doc [module_name] displays the help/documentation for a specific module.
Which default group includes all hosts in the inventory?
The all group implicitly contains every host defined in the inventory.
What is the purpose of the gather_facts directive?
It runs the setup module to populate ansible_facts.
Which directory in a Role contains the main list of tasks to be executed?
The tasks/main.yml file is the entry point for the tasks in a role.
How do you define a variable in a playbook?
The vars: section is used to define variables within a play.
What does the debug module do?
It prints a message or variable value to the console output.
Which command is used to download roles from Ansible Galaxy?
ansible-galaxy install [role_name] downloads the role to the local roles path.
Quiz Progress
0 / 0 questions answered
(0%)
0 correct
Quiz Complete!
0%