Role application
Roles are not plays. They do not possess any opinions about which hosts the role tasks should run on, what connection methods to use, whether to operate serially, or any other play behaviors described in Chapter 1, The System Architecture and Design of Ansible. Roles must be applied inside a play within a playbook, where all these opinions can be expressed.
To apply a role within a play, the roles operator is used. This operator expects a list of roles to apply to the hosts in the play. Much like describing role dependencies, when describing roles to apply, data can be passed along, such as variables, tags, and conditionals. The syntax is exactly the same.
To demonstrate applying roles within a play, let's create a simple ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access