Chef-Client Supermarket cookbook
- Using this cookbook from supermarket
- Convergence can be changed
- Scheduled jobs can be created
- Chef-Client log locations can be changed.
Changing default convergance of a node to 2 hours.
- search for chef-client cookbook in Chef Supermarket. Refer Here
- Create a cookbook called as changecovnergence.
depends 'chef-client', '~> 11.4.0'to metadata.rb
- create a attribute file called as default using
chef generate attribute . default
- In the attributes/default.rb add the following line
default['chef_client']['interval'] = 7200
- In recipes/default.rb add the following line
- Now upload this cookbook to chef server using berks upload and add this recipe to run_list of any node will change convergence from 30 minutes to 2 hours.
- The Servers look as shown below
- How do you design this deployment using chef
- Create 3 cookbooks
- IIS Server
- use kitchen to verify cookbooks are working
- upload the cookbooks to chef server
- Ensure all the 8 servers are bootstrapped.
- Change the run_list of each server and add the necessary recipe or recipe list
- Bootstrapping multiple servers
- Changing run list of every server
Change in scenario.
- Lets assume you are asked to install git on every node.
- For this we need to change the run list of every node.
Lets try to minimize efforts in Changing run_lists
Chef has a concept called as role.
Role is nothing but list of recipes.
We create 3 roles
- mysql-role => mysql::default
- tomcat-role => tomcat::default
- iis-role => iis::default
In all the server where i need mysql to be installed in run_list i will add mysql-role
In all the server where i need tomcat to be installed in run_list i will add tomcat-role
In all the server where i need iis to be installed in run_list i will add iis-role
If i need to add git to every node, there is no need to change run_list just edit the roles.
- mysql-role => mysql::default, git::default
- tomcat-role => tomcat::default, git::default
- iis-role => iis::default, git::default
Its always a best practice to have roles like