The directory layout for roles

Roles are nothing but directories laid out in a specific manner. Roles follow predefined directory layout conventions and expect each component to be in the path meant for it.

The following is an example of a role, called Nginx:

The directory layout for roles

Let's now look at the rules of the game and what each of the components in the preceding diagram is for:

  • Each role contains a directory which is named after itself, for example, Nginx, with roles/ as its parent directory. Each named role directory contains one or more optional subdirectories. The most common subdirectories to be present are tasks, templates, and handlers. Each of these subdirectories ...

Get Ansible Playbook Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.