[chef] Re: Re: What is the best way to install many sets of same environment with different properties in Chef?


Chronological Thread 
  • From: jeffty < >
  • To:
  • Subject: [chef] Re: Re: What is the best way to install many sets of same environment with different properties in Chef?
  • Date: Mon, 4 May 2015 00:53:06 +0800

Thanks Dey!

 

Will look through the blenderJ


2015-05-01 23:53 GMT+08:00 Ranjib Dey < " target="_blank"> >:
a) capture the order of nodes you need to provision (i.e. mq -> mysql -> jboss), we'll need this later
b) for all of this rypes, declare roles. separate the installation and cofiguration in distinct recipes/sub-recipe if need be. i.r recipe[jboss::install], recipe[jboss::configure], Installation should not need discovery, and can be parellelized
c) provision all the nodes with the recipes, those who does not need discovery can be provisioned with roles directly.
d) ::configure sub recipes will require chef search for sub recipes (i'll recommend using partial search, and use roles as search predicate instead of attributes). apply them in your intended order by directly assigning the roles. you can use knife-ssh, ansible of blender for that bit.

This will allow you to write individual recipes clutter free, independently testable. roles being an aggregation of both install, and configure recipe, will always ensure both recipes are applied on every node , every time. i.e. the initial bootstrap recipe is a subset of node's final run-list.
 
we wrote blender[1] & blender-chef[2] to deal with such scenarios. It will allow you to capture the whole workflow as a knife plugin :-) . like `knife jboss environment create` 




On Fri, May 1, 2015 at 7:04 AM, jeffty < " target="_blank"> > wrote:

Hi there,

 

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:

 

Approach One:

 

1.      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.

 

2.      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.

 

3.      Edit run_list of these chef nodes in chef server with according role.

 

4.      SSH into these servers and run chef-client.

 

5.      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.

 

 

Approach Two:

 

1.      Create cookbooks in chef server and bootstrap chef client for needed servers.

 

2.      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.

 

3.      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!

 

Thanks.






Archive powered by MHonArc 2.6.16.

§