An Ansible role is a set of tasks, templates, files, and variables that can be used to define a complex set of activities to be performed. Roles allow users to break up their playbook into smaller, reusable components.
For example, if a user wanted to install a web server, they could create a role called “webserver” that would include tasks for installing Apache, configuring the server, and setting up virtual hosts. The user could then include this role in their playbook, so that it runs whenever the playbook is executed.