Automating Infrastructure with Ansible: Best Practices
Assess your understanding of best practices in automating infrastructure using Ansible.
Questions in this quiz
12 questions on Automating Infrastructure with Ansible: Best Practices. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of using Ansible roles?
- ATo organize playbooks into reusable components
- BTo execute tasks in parallel
- CTo encrypt sensitive data
- DTo manage inventory files
2.Which Ansible module is used to manage packages on a Debian-based system?
- Ayum
- Bpackage
- Cdnf
- Dapt
3.How can you ensure idempotency in Ansible playbooks?
- ABy using modules that support state management
- BBy using the 'changed_when' directive
- CBy using conditionals
- DBy using the 'notify' directive
4.What is the recommended way to handle sensitive data in Ansible?
- AEncrypt it with a third-party tool
- BUse environment variables
- CStore it in plain text within playbooks
- DUse Ansible Vault
5.Which of the following is a best practice for writing Ansible playbooks?
- AUse hard-coded values
- BAvoid using variables
- CUse descriptive names for tasks
- DWrite monolithic playbooks
6.What is the advantage of using Ansible Galaxy?
- AIt automates the installation of Ansible
- BIt is a cloud-based service for Ansible
- CIt offers a collection of reusable roles
- DIt provides a GUI for Ansible
7.In Ansible, what is the purpose of the 'handlers' section?
- ATo perform actions upon notification
- BTo define reusable tasks
- CTo manage inventory
- DTo execute tasks conditionally
8.Which command is used to test the syntax of an Ansible playbook?
- Aansible-playbook --dry-run
- Bansible-playbook --validate
- Cansible-playbook --check
- Dansible-playbook --syntax-check
9.What is the role of the 'inventory' file in Ansible?
- ATo encrypt sensitive data
- BTo configure Ansible settings
- CTo store playbook variables
- DTo define the hosts and groups to manage
10.How can you limit the execution of a playbook to a specific group of hosts?
- AUse the '--tags' option
- BUse the '--inventory' option
- CUse the '--limit' option
- DUse the '--extra-vars' option
11.What is the purpose of the 'gather_facts' directive in Ansible?
- ATo encrypt playbook variables
- BTo collect information about the target system
- CTo manage role dependencies
- DTo define task dependencies
12.Which Ansible feature allows for the execution of tasks on multiple machines in parallel?
- AForks
- BAsynchronous tasks
- CRolling updates
- DSerial execution