Interview Prep/Ansible/Roles, Collections and Galaxy

What is a role and why use one?

BeginnerConceptRoles, Collections and Galaxy
Answer

A role is a standard directory layout that packages tasks, handlers, templates, files and variables for one purpose, such as nginx or postgres. Playbooks then become a short list of roles applied to host groups.

Benefits: reuse across projects, a single place to test and version the logic, a documented variable interface, and smaller playbooks that read like an architecture diagram.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy