0 votes
in Ansible by (909 points)
What is Ansible roles and their purpose?

1 Answer

0 votes
by (13.1k points)

Role is a group of variables, tasks, files and handlers that store in standardized file structure. Roles facilitate reuse and modularization of configuration. For ex: 2 roles have been written, 1 for Apache HTTP and second one for Apache Tomcat. Now if you need to configure HTTP and Tomcat both on a server than you can just include both roles in playbook or if you need only one from it then include only 1 role in playbook. In this way, there is no need of major changes in 

playbook other than modification of role name, thus provide reusability and modularity.  So, role is in simple words are small blocks, which can be used as per requirement anywhere to build big or small wall. 

Related questions