DevOps / Ansible Interview questions
What is the difference between roles and collections?
| Role | Collection |
| A single reusable unit: tasks, handlers, templates for one purpose. | A packaging format that can bundle multiple roles, modules, plugins, and docs together. |
| Distributed individually via Ansible Galaxy. | Distributed as a versioned package (also via Galaxy or private repositories). |
| Referenced directly by name in a playbook's roles: list. | Referenced with a namespace, e.g. community.docker.docker_container. |
A role is the older, simpler unit of reuse focused purely on tasks/handlers/templates for one job. A collection is the modern distribution format that can contain many roles plus custom modules, plugins, and inventory sources, all versioned and namespaced together (like community.docker or amazon.aws). In practice they're complementary rather than competing: a collection often contains one or more roles inside it, and most of Ansible's own built-in functionality now ships as the ansible.builtin collection.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
