Skip to main content

Structure for Ansibles

Ansible structure is how automation is organised for reuse. A role packages tasks, handlers, templates, defaults and files in a standard directory layout, and collections distribute roles, modules and plugins through Ansible Galaxy or private sources, so teams can share and version automation instead of copying playbooks.

Stage: Organisation · Part of the Ansible roadmap · Last reviewed 19 November 2026

What to learn in Structure

Structure interview questions

What is the difference between a role and a collection?

A role is a reusable bundle of tasks, handlers, variables and templates for one purpose, such as configuring nginx. A collection is a distribution format that can contain many roles plus modules, plugins and documentation under a namespace, installed with ansible-galaxy collection install.

Why put values in role defaults instead of vars?

Role defaults have the lowest precedence, so users can override them easily from inventory or the playbook. Values in vars rank much higher and are hard to override, so they should hold internal constants. Defaults make a role configurable without editing it.

Where Structure fits in the Ansible roadmap

Structure belongs to the Organisation stage (intermediate level). Reuse and scale.

Back to the full Ansible roadmap