Ansible role

A reusable package of tasks, handlers, templates, files and variables for one unit of automation, laid out in a standard directory structure.

In more detail

A play applies a role by listing it under roles, and can pass variables to customise it. The role owns its implementation, while the caller only chooses hosts and inputs, which lets several plays and projects share it. Document what the role guarantees after it runs; that contract guides its tasks and its tests.

Example

roles:
  - role: web
    vars:
      site_name: Training site

Related terms

Taught in

References

Certification courses