Chapter 8: Simplifying Playbooks with Roles and Collections
Use roles and content collections to develop playbooks more quickly and reuse code.
What you will learn
- Describe the purpose of a role, its structure, and how roles are used in playbooks.
- Create a role in a playbook's project directory and run it as part of a play.
- Select and retrieve roles from external sources such as Git repositories or Ansible Galaxy, and use them in playbooks.
- Obtain a set of related roles, modules and other content from a content collection, and use them in a playbook.
- Write playbooks that use the system roles to perform standard operations.
Sections
- Describing role structure
- Creating roles
- Exercise: Creating roles
- Deploying roles from external content sources
- Exercise: Deploying roles from external content sources
- Getting roles and modules from collections
- Exercise: Getting roles and modules from content collections
- Reusing content with system roles
- Exercise: Reusing content with system roles
- Exercise: Simplifying playbooks with roles and content collections
- Ansible roles and collections quiz
- Ansible roles and collections cheat sheet