Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm getting started with Chef and I've got a couple of things work which is great. I'm a little stuck though with how to use the Apache2 recipe to configure a virtual host. I have 5 hosts to set up and I'm wondering where the best place is to store this config data and how the recipe calls them.

Do I store them in a databag? If so how do I then use this data? Do I set up another recipe that calls the web_app or apache_site definition to create them?

The Chef documentation is a little thin around how you should make these kinds of modifications.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I don't think it matters too much actually where you store it, but it would depend on what you need to do. A databag is globally available, so all of your recipes will see it but attributes can be set per server, per role, or per environment.

I would put it in a role level attribute personally. That would allow you to to create a role that would deploy a certain web app with all its dependencies. Just cycle through that attribute and call apache_site for all the apps in that role's attribute. Then put some recipes to install php/apache/mysql/whatever to fulfill the requirements for that site inside the role.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.