InterviewSolution
| 1. |
What are the roles in Chef? Why do we use them? |
|
Answer» Chef nodes in your infrastructure may perform different roles at different times. For EG: Few of the Chef nodes would be web servers and one would be a load balancer. Grouping of the nodes into web servers and load balancer could be achieved in Chef using “roles” FEATURE. The roles are defined through the role ATTRIBUTES. You can assign roles to your identical servers and all of them can go ahead and run the same run list mapped to the corresponding role. This helps in avoiding the process of running run lists manually on each node each time when you have many nodes performing the same function. For configuring a new role for our node, we can make use of Knife commands. As a prerequisite, any previous roles or recipes on the run list can be removed using the “knife node run-list remove” command and then we can go ahead and add our newly added role using the “knife node run-list add role” command. The role attributes could only be defined as either ‘default’ or ‘override’ attributes. When a Chef Client run happens, the role attributes are matched against the attributes PRESENT on the node and if it takes PRECEDENCE over default attributes, new settings are applied. |
|