# Chef-solo and different server configs

**URL:** <https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190>\
**Category:** Chef Infra (archive)\
**Created:** [November 18, 2011, 9:14pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190 "2011-11-18T21:14:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [November 18, 2011, 9:14pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/1 "2011-11-18T21:14:47Z")

</div>

I’m planning on setting things up with the below setup. This is for a 2-4  
server setup, looking for guidance/best practises for a chef-solo repo.

When using chef-solo with a setup like:

/var/chef-solo/  
/var/chef-solo/cookbooks

If I have web servers, a db server, etc. to configure, I guess it is just a  
matter of having the necessary recipies in the cookbook and then creating a  
seperate .json file like web1.json and db1.json correct?

I’ll save this in a git repo, so that if I need to update anything I can  
then run a command than will update the repo’s of all my servers, and then  
run the chef-solo command.

Running chef with:

chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![Hector\_Castro](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/hector_castro/32/617_2.png) [@Hector\_Castro](https://discourse.chef.io/u/Hector_Castro)\
**Post date:** [November 19, 2011, 4:40pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/2 "2011-11-19T16:40:28Z")

</div>

I'd be interested to see other people's approaches to this as well. Right now I have chef-solo 2-4 server setup as well.

First, I install Chef via APT at OS install time with preseeding. On Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by default.

I have a Git repository housing everything that eventually gets sync'd to /var/cache/chef. In config/ of that repository, I have one JSON file for each node. In roles/ I have all of the shared role JSON files. Cookbooks live in cookbooks/ and site-cookbooks/.

--  
Hector

On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:

> I'm planning on setting things up with the below setup. This is for a 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> 
> When using chef-solo with a setup like:
> 
> /var/chef-solo/  
> /var/chef-solo/cookbooks
> 
> If I have web servers, a db server, etc. to configure, I guess it is just a matter of having the necessary recipies in the cookbook and then creating a seperate .json file like web1.json and db1.json correct?
> 
> I'll save this in a git repo, so that if I need to update anything I can then run a command than will update the repo's of all my servers, and then run the chef-solo command.
> 
> Running chef with:
> 
> chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [November 19, 2011, 4:45pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/3 "2011-11-19T16:45:13Z")

</div>

With ubuntu, are you using cloudinit to preseed?

But with this setup, you have to run a different chef-solo command for each  
node type correct?

I guess to automate this a little further, you could have some sort of  
lookup system (maybe the hostname?) and look for a pattern, like if you  
hosts are prefixed with 'db' then it is a database node type or 'www' for a  
front end server.

On Sat, Nov 19, 2011 at 11:40 AM, Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com)wrote:

> I'd be interested to see other people's approaches to this as well. Right  
> now I have chef-solo 2-4 server setup as well.
> 
> First, I install Chef via APT at OS install time with preseeding. On  
> Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by  
> default.
> 
> I have a Git repository housing everything that eventually gets sync'd to  
> /var/cache/chef. In config/ of that repository, I have one JSON file for  
> each node. In roles/ I have all of the shared role JSON files. Cookbooks  
> live in cookbooks/ and site-cookbooks/.
> 
> --  
> Hector
> 
> On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:
> 
> > I'm planning on setting things up with the below setup. This is for a  
> > 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> > 
> > When using chef-solo with a setup like:
> > 
> > /var/chef-solo/  
> > /var/chef-solo/cookbooks
> > 
> > If I have web servers, a db server, etc. to configure, I guess it is  
> > just a matter of having the necessary recipies in the cookbook and then  
> > creating a seperate .json file like web1.json and db1.json correct?
> > 
> > I'll save this in a git repo, so that if I need to update anything I can  
> > then run a command than will update the repo's of all my servers, and then  
> > run the chef-solo command.
> > 
> > Running chef with:
> > 
> > chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![Hector\_Castro](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/hector_castro/32/617_2.png) [@Hector\_Castro](https://discourse.chef.io/u/Hector_Castro)\
**Post date:** [November 19, 2011, 4:58pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/4 "2011-11-19T16:58:54Z")

</div>

Not using CloudInit yet. Currently deploying to an internal VMware setup with standard 11.10 server images. My preseed file:

```
https://gist.github.com/1377459

```

In my setup all of the nodes actually serve the same purpose. I wrote a little Capistrano task to make the remote chef-solo runs a little more automated. It handles synchronizing the repository and executing Chef.

--  
Hector

On Nov 19, 2011, at 11:45 AM, S Ahmed wrote:

> With ubuntu, are you using cloudinit to preseed?
> 
> But with this setup, you have to run a different chef-solo command for each node type correct?
> 
> I guess to automate this a little further, you could have some sort of lookup system (maybe the hostname?) and look for a pattern, like if you hosts are prefixed with 'db' then it is a database node type or 'www' for a front end server.
> 
> On Sat, Nov 19, 2011 at 11:40 AM, Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com) wrote:  
> I'd be interested to see other people's approaches to this as well. Right now I have chef-solo 2-4 server setup as well.
> 
> First, I install Chef via APT at OS install time with preseeding. On Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by default.
> 
> I have a Git repository housing everything that eventually gets sync'd to /var/cache/chef. In config/ of that repository, I have one JSON file for each node. In roles/ I have all of the shared role JSON files. Cookbooks live in cookbooks/ and site-cookbooks/.
> 
> --  
> Hector
> 
> On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:
> 
> > I'm planning on setting things up with the below setup. This is for a 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> > 
> > When using chef-solo with a setup like:
> > 
> > /var/chef-solo/  
> > /var/chef-solo/cookbooks
> > 
> > If I have web servers, a db server, etc. to configure, I guess it is just a matter of having the necessary recipies in the cookbook and then creating a seperate .json file like web1.json and db1.json correct?
> > 
> > I'll save this in a git repo, so that if I need to update anything I can then run a command than will update the repo's of all my servers, and then run the chef-solo command.
> > 
> > Running chef with:
> > 
> > chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![Jesse\_Robbins](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_robbins/32/660_2.png) [@Jesse\_Robbins](https://discourse.chef.io/u/Jesse_Robbins)\
**Post date:** [November 19, 2011, 7:10pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/5 "2011-11-19T19:10:49Z")

</div>

Out of curiosity, why use solo for this rather than hosted chef or chef-server? I want to better understand your use cases. (It seems like you may be doing a lot of work to do things that Chef exists to do and does well.)

-Jesse

On Nov 19, 2011, at 8:58 AM, Hector Castro wrote:

> Not using CloudInit yet. Currently deploying to an internal VMware setup with standard 11.10 server images. My preseed file:
> 
> [https://gist.github.com/1377459](https://gist.github.com/1377459)
> 
> In my setup all of the nodes actually serve the same purpose. I wrote a little Capistrano task to make the remote chef-solo runs a little more automated. It handles synchronizing the repository and executing Chef.
> 
> --  
> Hector
> 
> On Nov 19, 2011, at 11:45 AM, S Ahmed wrote:
> 
> > With ubuntu, are you using cloudinit to preseed?
> > 
> > But with this setup, you have to run a different chef-solo command for each node type correct?
> > 
> > I guess to automate this a little further, you could have some sort of lookup system (maybe the hostname?) and look for a pattern, like if you hosts are prefixed with 'db' then it is a database node type or 'www' for a front end server.
> > 
> > On Sat, Nov 19, 2011 at 11:40 AM, Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com) wrote:  
> > I'd be interested to see other people's approaches to this as well. Right now I have chef-solo 2-4 server setup as well.
> > 
> > First, I install Chef via APT at OS install time with preseeding. On Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by default.
> > 
> > I have a Git repository housing everything that eventually gets sync'd to /var/cache/chef. In config/ of that repository, I have one JSON file for each node. In roles/ I have all of the shared role JSON files. Cookbooks live in cookbooks/ and site-cookbooks/.
> > 
> > --  
> > Hector
> > 
> > On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:
> > 
> > > I'm planning on setting things up with the below setup. This is for a 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> > > 
> > > When using chef-solo with a setup like:
> > > 
> > > /var/chef-solo/  
> > > /var/chef-solo/cookbooks
> > > 
> > > If I have web servers, a db server, etc. to configure, I guess it is just a matter of having the necessary recipies in the cookbook and then creating a seperate .json file like web1.json and db1.json correct?
> > > 
> > > I'll save this in a git repo, so that if I need to update anything I can then run a command than will update the repo's of all my servers, and then run the chef-solo command.
> > > 
> > > Running chef with:
> > > 
> > > chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![Hector\_Castro](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/hector_castro/32/617_2.png) [@Hector\_Castro](https://discourse.chef.io/u/Hector_Castro)\
**Post date:** [November 19, 2011, 11:33pm UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/6 "2011-11-19T23:33:12Z")

</div>

Hi Jesse,

In my specific case the dependencies of chef-server make it a tough sell – especially since I'm just starting to get Chef in the door and there isn't a ton of adoption. Absolutely no disrespect to Chef's capabilities intended.

--  
Hector

On Nov 19, 2011, at 2:10 PM, Jesse Robbins wrote:

> Out of curiosity, why use solo for this rather than hosted chef or chef-server? I want to better understand your use cases. (It seems like you may be doing a lot of work to do things that Chef exists to do and does well.)
> 
> -Jesse
> 
> On Nov 19, 2011, at 8:58 AM, Hector Castro wrote:
> 
> > Not using CloudInit yet. Currently deploying to an internal VMware setup with standard 11.10 server images. My preseed file:
> > 
> > [https://gist.github.com/1377459](https://gist.github.com/1377459)
> > 
> > In my setup all of the nodes actually serve the same purpose. I wrote a little Capistrano task to make the remote chef-solo runs a little more automated. It handles synchronizing the repository and executing Chef.
> > 
> > --  
> > Hector
> > 
> > On Nov 19, 2011, at 11:45 AM, S Ahmed wrote:
> > 
> > > With ubuntu, are you using cloudinit to preseed?
> > > 
> > > But with this setup, you have to run a different chef-solo command for each node type correct?
> > > 
> > > I guess to automate this a little further, you could have some sort of lookup system (maybe the hostname?) and look for a pattern, like if you hosts are prefixed with 'db' then it is a database node type or 'www' for a front end server.
> > > 
> > > On Sat, Nov 19, 2011 at 11:40 AM, Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com) wrote:  
> > > I'd be interested to see other people's approaches to this as well. Right now I have chef-solo 2-4 server setup as well.
> > > 
> > > First, I install Chef via APT at OS install time with preseeding. On Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by default.
> > > 
> > > I have a Git repository housing everything that eventually gets sync'd to /var/cache/chef. In config/ of that repository, I have one JSON file for each node. In roles/ I have all of the shared role JSON files. Cookbooks live in cookbooks/ and site-cookbooks/.
> > > 
> > > --  
> > > Hector
> > > 
> > > On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:
> > > 
> > > > I'm planning on setting things up with the below setup. This is for a 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> > > > 
> > > > When using chef-solo with a setup like:
> > > > 
> > > > /var/chef-solo/  
> > > > /var/chef-solo/cookbooks
> > > > 
> > > > If I have web servers, a db server, etc. to configure, I guess it is just a matter of having the necessary recipies in the cookbook and then creating a seperate .json file like web1.json and db1.json correct?
> > > > 
> > > > I'll save this in a git repo, so that if I need to update anything I can then run a command than will update the repo's of all my servers, and then run the chef-solo command.
> > > > 
> > > > Running chef with:
> > > > 
> > > > chef-solo -c ~/solo.rb -j ~/web1.json

---

<div class="post-metadata">

**Author:** ![Miquel\_Torres](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/miquel_torres/32/768_2.png) [@Miquel\_Torres](https://discourse.chef.io/u/Miquel_Torres)\
**Post date:** [November 20, 2011, 9:28am UTC](https://discourse.chef.io/t/chef-solo-and-different-server-configs/2190/7 "2011-11-20T09:28:34Z")

</div>

Well, your use cases do seem like a good fit for LittleChef  
([GitHub - tobami/littlechef: Cook with Chef without a Chef Server](https://github.com/tobami/littlechef))

Instead of updating the git repo on each server, with LittleChef every  
user has a local checkout, and when reconfiguring a server the repo  
gets synchronized.

Also, because it allows you to use node search and the  
chef\_environment value from the beginning, it makes it easier to later  
move to a Chef Server configuration, as the recipes will be nearly  
100% compatible.

Have a look, maybe it fits your usage model!

2011/11/20 Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com):

> Hi Jesse,
> 
> In my specific case the dependencies of chef-server make it a tough sell – especially since I'm just starting to get Chef in the door and there isn't a ton of adoption. Absolutely no disrespect to Chef's capabilities intended.
> 
> --  
> Hector
> 
> On Nov 19, 2011, at 2:10 PM, Jesse Robbins wrote:
> 
> > Out of curiosity, why use solo for this rather than hosted chef or chef-server? I want to better understand your use cases. (It seems like you may be doing a lot of work to do things that Chef exists to do and does well.)
> > 
> > -Jesse
> > 
> > On Nov 19, 2011, at 8:58 AM, Hector Castro wrote:
> > 
> > > Not using CloudInit yet. Currently deploying to an internal VMware setup with standard 11.10 server images. My preseed file:
> > > 
> > > ```
> > > https://gist.github.com/1377459
> > > 
> > > ```
> > > 
> > > In my setup all of the nodes actually serve the same purpose. I wrote a little Capistrano task to make the remote chef-solo runs a little more automated. It handles synchronizing the repository and executing Chef.
> > > 
> > > --  
> > > Hector
> > > 
> > > On Nov 19, 2011, at 11:45 AM, S Ahmed wrote:
> > > 
> > > > With ubuntu, are you using cloudinit to preseed?
> > > > 
> > > > But with this setup, you have to run a different chef-solo command for each node type correct?
> > > > 
> > > > I guess to automate this a little further, you could have some sort of lookup system (maybe the hostname?) and look for a pattern, like if you hosts are prefixed with 'db' then it is a database node type or 'www' for a front end server.
> > > > 
> > > > On Sat, Nov 19, 2011 at 11:40 AM, Hector Castro [hectcastro@gmail.com](mailto:hectcastro@gmail.com) wrote:  
> > > > I'd be interested to see other people's approaches to this as well. Right now I have chef-solo 2-4 server setup as well.
> > > > 
> > > > First, I install Chef via APT at OS install time with preseeding. On Ubuntu/Debian Chef looks for cookbooks and roles in /var/cache/chef by default.
> > > > 
> > > > I have a Git repository housing everything that eventually gets sync'd to /var/cache/chef. In config/ of that repository, I have one JSON file for each node. In roles/ I have all of the shared role JSON files. Cookbooks live in cookbooks/ and site-cookbooks/.
> > > > 
> > > > --  
> > > > Hector
> > > > 
> > > > On Nov 18, 2011, at 4:14 PM, S Ahmed wrote:
> > > > 
> > > > > I'm planning on setting things up with the below setup. This is for a 2-4 server setup, looking for guidance/best practises for a chef-solo repo.
> > > > > 
> > > > > When using chef-solo with a setup like:
> > > > > 
> > > > > /var/chef-solo/  
> > > > > /var/chef-solo/cookbooks
> > > > > 
> > > > > If I have web servers, a db server, etc. to configure, I guess it is just a matter of having the necessary recipies in the cookbook and then creating a seperate .json file like web1.json and db1.json correct?
> > > > > 
> > > > > I'll save this in a git repo, so that if I need to update anything I can then run a command than will update the repo's of all my servers, and then run the chef-solo command.
> > > > > 
> > > > > Running chef with:
> > > > > 
> > > > > chef-solo -c ~/solo.rb -j ~/web1.json
