We have a chef server and hundreds of servers. The same set of applications will be installed in these servers, i.e. 1 JBoss server, 3 RabbitMQ nodes for message queue cluster, 2 db nodes for db cluster.
And many sets of such environment will be installed, we are seeking the best way for this with chef.
The obstacle is that while installing, node A may need to know the IP and service username/password of node B, we need to provide the post-configuration property through pre-configure or provide property file such as JSON file as the chef command’s parameter. We consider below approaches:
Create roles such as JBoss_server, Rabbitmq_node, Rabbitmq_cluster, Mysql_node etc. Download and upload related cookbooks in our chef server. Define the run_list and needed property of these roles. E.g. while install mq cluster, we need to install mq_node1, then mq_node2, then provide node1’s ip for node2, register node2 into node1 as the cluster after installation.
Pickup enough servers, bootstrap chef-client for them from chef server with their SSH username/password. Created chef node such as set1-jboss, set1-mq1, set1-mqcluster, set1-mysqlnode1, set1-mysqlnode2, set2-jboss… etc.
Edit run_list of these chef nodes in chef server with according role.
SSH into these servers and run chef-client.
Repeat step 1 – step 4, create roles such as JBoss_server2, Rabbitmq_node2 and their run_list and needed properties etc. if another request comes to install another set of environment.
The installation request may come parallel – install two or more sets at the same time.
Create cookbooks in chef server and bootstrap chef client for needed servers.
SSH into all these servers, create property file such as set1_jboss.json, set1_mq_node1.json, set1_mq_cluster.json etc. in each server. Run chef-client, specify the cookbook name and –j xxx.json to start installation.
Repeat step 2, create property file such as set2_jboss.json, set2_mq_node1.json… etc. Run chef-client with –j parameter and the json file in that server to start installation.
Also we may meet another issue: how to deal with the situation for the cluster configuration: install service in node1, install service in node2, then go back to node1 and configure with node2’s information? Go to node1 and run cookbook 1, then go to node2 and run cookbook 2, at last go back to node1 and run cookbook 3 to complete the cluster configuration? This seems difficult for us.
We are newbie in chef and not sure which way is the best way, or neither of them is.
Appreciate for any suggestion or guidance for these questions, we know that we throw too many questions in the post!