# Managing Node Info

**URL:** <https://discourse.chef.io/t/managing-node-info/2156>\
**Category:** Chef Infra (archive)\
**Created:** [October 4, 2011, 7:22pm UTC](https://discourse.chef.io/t/managing-node-info/2156 "2011-10-04T19:22:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Espada](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jorge_espada/32/267_2.png) [@Jorge\_Espada](https://discourse.chef.io/u/Jorge_Espada)\
**Post date:** [October 4, 2011, 7:22pm UTC](https://discourse.chef.io/t/managing-node-info/2156/1 "2011-10-04T19:22:14Z")

</div>

Hi, what will be the right or better approach to store custom (non default)  
config attributes per node ?  
For instance, lets say that I have the tomcat or apache cookbook applied to  
4 nodes, and all of them have different config files, should I write 4  
different attributes files for that cookbook , also for each same cookbook  
applied to those nodes with different configs? Or is better to use data bags  
for custom configs on each nodes?

I know that attribute is a per-node thing. and data bag is across nodes.  
but I’m not sure how to sort this situation… or there is another thing that  
i’m missing

Thanks

Jorge E. Espada  
Phone: +54 9 341 5692435

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [October 4, 2011, 7:29pm UTC](https://discourse.chef.io/t/managing-node-info/2156/2 "2011-10-04T19:29:30Z")

</div>

Are they truly per-node, or are they four different roles?

Ideally, you would abstract the differences, and then just apply the  
attributes to each node through a role (or on the node itself, if it's  
truly one-off)

Best,  
Adam

On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com) wrote:

> Hi, what will be the right or better approach to store custom (non default)  
> config attributes per node ?  
> For instance, lets say that I have the tomcat or apache cookbook applied to  
> 4 nodes, and all of them have different config files, should I write 4  
> different attributes files for that cookbook , also for each same cookbook  
> applied to those nodes with different configs? Or is better to use data bags  
> for custom configs on each nodes?  
> I know that attribute is a per-node thing. and data bag is across nodes.  
> but I'm not sure how to sort this situation.. or there is another thing that  
> i'm missing  
> Thanks  
> Jorge E. Espada  
> Phone: +54 9 341 5692435

--  
Opscode, Inc.  
Adam Jacob, Chief Product Officer  
T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Jorge\_Espada](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jorge_espada/32/267_2.png) [@Jorge\_Espada](https://discourse.chef.io/u/Jorge_Espada)\
**Post date:** [October 4, 2011, 7:51pm UTC](https://discourse.chef.io/t/managing-node-info/2156/3 "2011-10-04T19:51:07Z")

</div>

Thanks Adam for answer, yes they are truly per-node, for instance we have:  
4 servers(nodes) called app[1-4] all of them are running tomcat and tomcat  
is configured to talk to an ejabberd cluster, but each of them are  
connected to a different server in that ejabberd cluster.. hence each node  
(app1 , app2...) has a different config for tomcat, despite they belong to  
the same services, let say app-services.. so what do you suggest one role  
per instance of the same service ?

Thanks

Jorge E. Espada  
Phone: +54 9 341 5692435  
On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:

> Are they truly per-node, or are they four different roles?
> 
> Ideally, you would abstract the differences, and then just apply the  
> attributes to each node through a role (or on the node itself, if it's  
> truly one-off)
> 
> Best,  
> Adam
> 
> On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> wrote:
> 
> > Hi, what will be the right or better approach to store custom (non  
> > default)  
> > config attributes per node ?  
> > For instance, lets say that I have the tomcat or apache cookbook applied  
> > to  
> > 4 nodes, and all of them have different config files, should I write 4  
> > different attributes files for that cookbook , also for each same  
> > cookbook  
> > applied to those nodes with different configs? Or is better to use data  
> > bags  
> > for custom configs on each nodes?  
> > I know that attribute is a per-node thing. and data bag is across  
> > nodes.  
> > but I'm not sure how to sort this situation.. or there is another thing  
> > that  
> > i'm missing  
> > Thanks  
> > Jorge E. Espada  
> > Phone: +54 9 341 5692435
> 
> --  
> Opscode, Inc.  
> Adam Jacob, Chief Product Officer  
> T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [October 4, 2011, 7:56pm UTC](https://discourse.chef.io/t/managing-node-info/2156/4 "2011-10-04T19:56:28Z")

</div>

Yeah, if they are really that tightly coupled (1:1) I would say they  
each have a different role (and they probably all use the same base  
role that specifies the bulk of the runlist, and those roles just set  
the couple of node attributes that matter.)

Adam

On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com) wrote:

> Thanks Adam for answer, yes they are truly per-node, for instance we have:  
> 4 servers(nodes) called app[1-4] all of them are running tomcat and tomcat  
> is configured to talk to an ejabberd cluster, but each of them are  
> connected to a different server in that ejabberd cluster.. hence each node  
> (app1 , app2...) has a different config for tomcat, despite they belong to  
> the same services, let say app-services.. so what do you suggest one role  
> per instance of the same service ?  
> Thanks  
> Jorge E. Espada  
> Phone: +54 9 341 5692435  
> On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> 
> > Are they truly per-node, or are they four different roles?
> > 
> > Ideally, you would abstract the differences, and then just apply the  
> > attributes to each node through a role (or on the node itself, if it's  
> > truly one-off)
> > 
> > Best,  
> > Adam
> > 
> > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > wrote:
> > 
> > > Hi, what will be the right or better approach to store custom (non  
> > > default)  
> > > config attributes per node ?  
> > > For instance, lets say that I have the tomcat or apache cookbook applied  
> > > to  
> > > 4 nodes, and all of them have different config files, should I write 4  
> > > different attributes files for that cookbook , also for each same  
> > > cookbook  
> > > applied to those nodes with different configs? Or is better to use data  
> > > bags  
> > > for custom configs on each nodes?  
> > > I know that attribute is a per-node thing. and data bag is across  
> > > nodes.  
> > > but I'm not sure how to sort this situation.. or there is another thing  
> > > that  
> > > i'm missing  
> > > Thanks  
> > > Jorge E. Espada  
> > > Phone: +54 9 341 5692435
> > 
> > --  
> > Opscode, Inc.  
> > Adam Jacob, Chief Product Officer  
> > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

--  
Opscode, Inc.  
Adam Jacob, Chief Product Officer  
T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [October 4, 2011, 8:09pm UTC](https://discourse.chef.io/t/managing-node-info/2156/5 "2011-10-04T20:09:39Z")

</div>

so if you have the same app in three different instances, dev, qa, and prod,  
you would abstract that application as a role?

On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:

> Yeah, if they are really that tightly coupled (1:1) I would say they  
> each have a different role (and they probably all use the same base  
> role that specifies the bulk of the runlist, and those roles just set  
> the couple of node attributes that matter.)
> 
> Adam
> 
> On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> wrote:
> 
> > Thanks Adam for answer, yes they are truly per-node, for instance we  
> > have:  
> > 4 servers(nodes) called app[1-4] all of them are running tomcat and  
> > tomcat  
> > is configured to talk to an ejabberd cluster, but each of them are  
> > connected to a different server in that ejabberd cluster.. hence each  
> > node  
> > (app1 , app2...) has a different config for tomcat, despite they belong  
> > to  
> > the same services, let say app-services.. so what do you suggest one role  
> > per instance of the same service ?  
> > Thanks  
> > Jorge E. Espada  
> > Phone: +54 9 341 5692435  
> > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > 
> > > Are they truly per-node, or are they four different roles?
> > > 
> > > Ideally, you would abstract the differences, and then just apply the  
> > > attributes to each node through a role (or on the node itself, if it's  
> > > truly one-off)
> > > 
> > > Best,  
> > > Adam
> > > 
> > > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > wrote:
> > > 
> > > > Hi, what will be the right or better approach to store custom (non  
> > > > default)  
> > > > config attributes per node ?  
> > > > For instance, lets say that I have the tomcat or apache cookbook  
> > > > applied  
> > > > to  
> > > > 4 nodes, and all of them have different config files, should I write 4  
> > > > different attributes files for that cookbook , also for each same  
> > > > cookbook  
> > > > applied to those nodes with different configs? Or is better to use  
> > > > data  
> > > > bags  
> > > > for custom configs on each nodes?  
> > > > I know that attribute is a per-node thing. and data bag is across  
> > > > nodes.  
> > > > but I'm not sure how to sort this situation.. or there is another  
> > > > thing  
> > > > that  
> > > > i'm missing  
> > > > Thanks  
> > > > Jorge E. Espada  
> > > > Phone: +54 9 341 5692435
> > > 
> > > --  
> > > Opscode, Inc.  
> > > Adam Jacob, Chief Product Officer  
> > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> 
> --  
> Opscode, Inc.  
> Adam Jacob, Chief Product Officer  
> T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Jorge\_Espada](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jorge_espada/32/267_2.png) [@Jorge\_Espada](https://discourse.chef.io/u/Jorge_Espada)\
**Post date:** [October 4, 2011, 8:15pm UTC](https://discourse.chef.io/t/managing-node-info/2156/6 "2011-10-04T20:15:21Z")

</div>

Thanks Adam, that's what i'm going to do.  
@Bryan I would say yes.. since you manage your env with chef environments  
[0]

[0] [http://wiki.opscode.com/display/chef/Environments](http://wiki.opscode.com/display/chef/Environments)

Jorge E. Espada  
Phone: +54 9 341 5692435

On Tue, Oct 4, 2011 at 5:09 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> so if you have the same app in three different instances, dev, qa, and  
> prod, you would abstract that application as a role?
> 
> On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> 
> > Yeah, if they are really that tightly coupled (1:1) I would say they  
> > each have a different role (and they probably all use the same base  
> > role that specifies the bulk of the runlist, and those roles just set  
> > the couple of node attributes that matter.)
> > 
> > Adam
> > 
> > On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > wrote:
> > 
> > > Thanks Adam for answer, yes they are truly per-node, for instance we  
> > > have:  
> > > 4 servers(nodes) called app[1-4] all of them are running tomcat and  
> > > tomcat  
> > > is configured to talk to an ejabberd cluster, but each of them are  
> > > connected to a different server in that ejabberd cluster.. hence each  
> > > node  
> > > (app1 , app2...) has a different config for tomcat, despite they belong  
> > > to  
> > > the same services, let say app-services.. so what do you suggest one  
> > > role  
> > > per instance of the same service ?  
> > > Thanks  
> > > Jorge E. Espada  
> > > Phone: +54 9 341 5692435  
> > > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > > 
> > > > Are they truly per-node, or are they four different roles?
> > > > 
> > > > Ideally, you would abstract the differences, and then just apply the  
> > > > attributes to each node through a role (or on the node itself, if it's  
> > > > truly one-off)
> > > > 
> > > > Best,  
> > > > Adam
> > > > 
> > > > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi, what will be the right or better approach to store custom (non  
> > > > > default)  
> > > > > config attributes per node ?  
> > > > > For instance, lets say that I have the tomcat or apache cookbook  
> > > > > applied  
> > > > > to  
> > > > > 4 nodes, and all of them have different config files, should I write  
> > > > > 4  
> > > > > different attributes files for that cookbook , also for each same  
> > > > > cookbook  
> > > > > applied to those nodes with different configs? Or is better to use  
> > > > > data  
> > > > > bags  
> > > > > for custom configs on each nodes?  
> > > > > I know that attribute is a per-node thing. and data bag is across  
> > > > > nodes.  
> > > > > but I'm not sure how to sort this situation.. or there is another  
> > > > > thing  
> > > > > that  
> > > > > i'm missing  
> > > > > Thanks  
> > > > > Jorge E. Espada  
> > > > > Phone: +54 9 341 5692435
> > > > 
> > > > --  
> > > > Opscode, Inc.  
> > > > Adam Jacob, Chief Product Officer  
> > > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> > 
> > --  
> > Opscode, Inc.  
> > Adam Jacob, Chief Product Officer  
> > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Aaron\_Abramson](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Aaron\_Abramson](https://discourse.chef.io/u/Aaron_Abramson)\
**Post date:** [October 4, 2011, 8:25pm UTC](https://discourse.chef.io/t/managing-node-info/2156/7 "2011-10-04T20:25:49Z")

</div>

How would one go about setting environment attributes for prod/qa/dev if each 'environment' is simply checked out into a separate vhost on the same node?

We're deploying a PHP app, and we have [admin.domain.com](http://admin.domain.com), [beta.domain.com](http://beta.domain.com) and [dev.domain.com](http://dev.domain.com) for our different environments, but they're all just vhosts with different docroots on the same node.

Right now I have 3 recipes, one for each environment, but I'd like to get to 1 recipe with 3 sets of attributes.

On Oct 4, 2011, at 3:15 PM, jorge espada wrote:

> Thanks Adam, that's what i'm going to do.  
> @Bryan I would say yes.. since you manage your env with chef environments [0]
> 
> [0] [http://wiki.opscode.com/display/chef/Environments](http://wiki.opscode.com/display/chef/Environments)
> 
> Jorge E. Espada  
> Phone: +54 9 341 5692435
> 
> On Tue, Oct 4, 2011 at 5:09 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:  
> so if you have the same app in three different instances, dev, qa, and prod, you would abstract that application as a role?
> 
> On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:  
> Yeah, if they are really that tightly coupled (1:1) I would say they  
> each have a different role (and they probably all use the same base  
> role that specifies the bulk of the runlist, and those roles just set  
> the couple of node attributes that matter.)
> 
> Adam
> 
> On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com) wrote:
> 
> > Thanks Adam for answer, yes they are truly per-node, for instance we have:  
> > 4 servers(nodes) called app[1-4] all of them are running tomcat and tomcat  
> > is configured to talk to an ejabberd cluster, but each of them are  
> > connected to a different server in that ejabberd cluster.. hence each node  
> > (app1 , app2...) has a different config for tomcat, despite they belong to  
> > the same services, let say app-services.. so what do you suggest one role  
> > per instance of the same service ?  
> > Thanks  
> > Jorge E. Espada  
> > Phone: +54 9 341 5692435  
> > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > 
> > > Are they truly per-node, or are they four different roles?
> > > 
> > > Ideally, you would abstract the differences, and then just apply the  
> > > attributes to each node through a role (or on the node itself, if it's  
> > > truly one-off)
> > > 
> > > Best,  
> > > Adam
> > > 
> > > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > wrote:
> > > 
> > > > Hi, what will be the right or better approach to store custom (non  
> > > > default)  
> > > > config attributes per node ?  
> > > > For instance, lets say that I have the tomcat or apache cookbook applied  
> > > > to  
> > > > 4 nodes, and all of them have different config files, should I write 4  
> > > > different attributes files for that cookbook , also for each same  
> > > > cookbook  
> > > > applied to those nodes with different configs? Or is better to use data  
> > > > bags  
> > > > for custom configs on each nodes?  
> > > > I know that attribute is a per-node thing. and data bag is across  
> > > > nodes.  
> > > > but I'm not sure how to sort this situation.. or there is another thing  
> > > > that  
> > > > i'm missing  
> > > > Thanks  
> > > > Jorge E. Espada  
> > > > Phone: +54 9 341 5692435
> > > 
> > > --  
> > > Opscode, Inc.  
> > > Adam Jacob, Chief Product Officer  
> > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> 
> --  
> Opscode, Inc.  
> Adam Jacob, Chief Product Officer  
> T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [October 4, 2011, 8:34pm UTC](https://discourse.chef.io/t/managing-node-info/2156/8 "2011-10-04T20:34:28Z")

</div>

damn, i was just about to ask that question 🙂

I have a number of tomcat apps that match your same use case

On Tue, Oct 4, 2011 at 10:25 PM, Aaron Abramson [aabramson@wi-figuys.com](mailto:aabramson@wi-figuys.com)wrote:

> How would one go about setting environment attributes for prod/qa/dev if  
> each 'environment' is simply checked out into a separate vhost on the same  
> node?
> 
> We're deploying a PHP app, and we have [admin.domain.com](http://admin.domain.com), beta.domain.comand  
> [dev.domain.com](http://dev.domain.com) for our different environments, but they're all just vhosts  
> with different docroots on the same node.
> 
> Right now I have 3 recipes, one for each environment, but I'd like to get  
> to 1 recipe with 3 sets of attributes.
> 
> On Oct 4, 2011, at 3:15 PM, jorge espada wrote:
> 
> Thanks Adam, that's what i'm going to do.  
> @Bryan I would say yes.. since you manage your env with chef environments  
> [0]
> 
> [0] [http://wiki.opscode.com/display/chef/Environments](http://wiki.opscode.com/display/chef/Environments)
> 
> Jorge E. Espada  
> Phone: +54 9 341 5692435
> 
> On Tue, Oct 4, 2011 at 5:09 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:
> 
> > so if you have the same app in three different instances, dev, qa, and  
> > prod, you would abstract that application as a role?
> > 
> > On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > 
> > > Yeah, if they are really that tightly coupled (1:1) I would say they  
> > > each have a different role (and they probably all use the same base  
> > > role that specifies the bulk of the runlist, and those roles just set  
> > > the couple of node attributes that matter.)
> > > 
> > > Adam
> > > 
> > > On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > wrote:
> > > 
> > > > Thanks Adam for answer, yes they are truly per-node, for instance we  
> > > > have:  
> > > > 4 servers(nodes) called app[1-4] all of them are running tomcat and  
> > > > tomcat  
> > > > is configured to talk to an ejabberd cluster, but each of them are  
> > > > connected to a different server in that ejabberd cluster.. hence each  
> > > > node  
> > > > (app1 , app2...) has a different config for tomcat, despite they belong  
> > > > to  
> > > > the same services, let say app-services.. so what do you suggest one  
> > > > role  
> > > > per instance of the same service ?  
> > > > Thanks  
> > > > Jorge E. Espada  
> > > > Phone: +54 9 341 5692435  
> > > > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > > > 
> > > > > Are they truly per-node, or are they four different roles?
> > > > > 
> > > > > Ideally, you would abstract the differences, and then just apply the  
> > > > > attributes to each node through a role (or on the node itself, if it's  
> > > > > truly one-off)
> > > > > 
> > > > > Best,  
> > > > > Adam
> > > > > 
> > > > > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada \<[espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)
> > > > 
> > > > > wrote:
> > > > > 
> > > > > > Hi, what will be the right or better approach to store custom (non  
> > > > > > default)  
> > > > > > config attributes per node ?  
> > > > > > For instance, lets say that I have the tomcat or apache cookbook  
> > > > > > applied  
> > > > > > to  
> > > > > > 4 nodes, and all of them have different config files, should I write  
> > > > > > 4  
> > > > > > different attributes files for that cookbook , also for each same  
> > > > > > cookbook  
> > > > > > applied to those nodes with different configs? Or is better to use  
> > > > > > data  
> > > > > > bags  
> > > > > > for custom configs on each nodes?  
> > > > > > I know that attribute is a per-node thing. and data bag is across  
> > > > > > nodes.  
> > > > > > but I'm not sure how to sort this situation.. or there is another  
> > > > > > thing  
> > > > > > that  
> > > > > > i'm missing  
> > > > > > Thanks  
> > > > > > Jorge E. Espada  
> > > > > > Phone: +54 9 341 5692435
> > > > > 
> > > > > --  
> > > > > Opscode, Inc.  
> > > > > Adam Jacob, Chief Product Officer  
> > > > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> > > 
> > > --  
> > > Opscode, Inc.  
> > > Adam Jacob, Chief Product Officer  
> > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [October 4, 2011, 10:37pm UTC](https://discourse.chef.io/t/managing-node-info/2156/9 "2011-10-04T22:37:24Z")

</div>

If the application is identical, and the only difference is data, I would:

1. Have a base role that defines how to deploy your app, primarily  
about the run list, and any common attributes.

name "app\_base"  
run\_list ["recipe[app]" ]

1. Have a role for each vhost that uses an attribute like this:

name "app\_admin"  
run\_list ["role[app\_base]" ]  
default\_attributes(  
{  
"app" =\> {  
"vhosts" =\> {  
"[admin.domain.com](http://admin.domain.com)" =\> "/srv/admin.domain.com"  
}  
}  
}  
)

1. Have the app recipe walk the node["app"]["vhosts"], doing your  
docroot creation, code checkout, and webserver configs

2. Assign the roles to the nodes

If you were going to do this a lot, you could change the above to use  
data bags - but for the small use case you submitted here, I wouldn't  
bother.

On Tue, Oct 4, 2011 at 1:25 PM, Aaron Abramson [aabramson@wi-figuys.com](mailto:aabramson@wi-figuys.com) wrote:

> How would one go about setting environment attributes for prod/qa/dev if  
> each 'environment' is simply checked out into a separate vhost on the same  
> node?  
> We're deploying a PHP app, and we have [admin.domain.com](http://admin.domain.com), [beta.domain.com](http://beta.domain.com) and  
> [dev.domain.com](http://dev.domain.com) for our different environments, but they're all just vhosts  
> with different docroots on the same node.  
> Right now I have 3 recipes, one for each environment, but I'd like to get to  
> 1 recipe with 3 sets of attributes.
> 
> On Oct 4, 2011, at 3:15 PM, jorge espada wrote:
> 
> Thanks Adam, that's what i'm going to do.  
> @Bryan I would say yes.. since you manage your env with chef environments  
> [0]  
> [0] [http://wiki.opscode.com/display/chef/Environments](http://wiki.opscode.com/display/chef/Environments)
> 
> Jorge E. Espada  
> Phone: +54 9 341 5692435
> 
> On Tue, Oct 4, 2011 at 5:09 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:
> 
> > so if you have the same app in three different instances, dev, qa, and  
> > prod, you would abstract that application as a role?
> > 
> > On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > 
> > > Yeah, if they are really that tightly coupled (1:1) I would say they  
> > > each have a different role (and they probably all use the same base  
> > > role that specifies the bulk of the runlist, and those roles just set  
> > > the couple of node attributes that matter.)
> > > 
> > > Adam
> > > 
> > > On Tue, Oct 4, 2011 at 12:51 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > wrote:
> > > 
> > > > Thanks Adam for answer, yes they are truly per-node, for instance we  
> > > > have:  
> > > > 4 servers(nodes) called app[1-4] all of them are running tomcat and  
> > > > tomcat  
> > > > is configured to talk to an ejabberd cluster, but each of them are  
> > > > connected to a different server in that ejabberd cluster.. hence each  
> > > > node  
> > > > (app1 , app2...) has a different config for tomcat, despite they belong  
> > > > to  
> > > > the same services, let say app-services.. so what do you suggest one  
> > > > role  
> > > > per instance of the same service ?  
> > > > Thanks  
> > > > Jorge E. Espada  
> > > > Phone: +54 9 341 5692435  
> > > > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob [adam@opscode.com](mailto:adam@opscode.com) wrote:
> > > > 
> > > > > Are they truly per-node, or are they four different roles?
> > > > > 
> > > > > Ideally, you would abstract the differences, and then just apply the  
> > > > > attributes to each node through a role (or on the node itself, if it's  
> > > > > truly one-off)
> > > > > 
> > > > > Best,  
> > > > > Adam
> > > > > 
> > > > > On Tue, Oct 4, 2011 at 12:22 PM, jorge espada [espada.jorge@gmail.com](mailto:espada.jorge@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi, what will be the right or better approach to store custom (non  
> > > > > > default)  
> > > > > > config attributes per node ?  
> > > > > > For instance, lets say that I have the tomcat or apache cookbook  
> > > > > > applied  
> > > > > > to  
> > > > > > 4 nodes, and all of them have different config files, should I write  
> > > > > > 4  
> > > > > > different attributes files for that cookbook , also for each same  
> > > > > > cookbook  
> > > > > > applied to those nodes with different configs? Or is better to use  
> > > > > > data  
> > > > > > bags  
> > > > > > for custom configs on each nodes?  
> > > > > > I know that attribute is a per-node thing. and data bag is across  
> > > > > > nodes.  
> > > > > > but I'm not sure how to sort this situation.. or there is another  
> > > > > > thing  
> > > > > > that  
> > > > > > i'm missing  
> > > > > > Thanks  
> > > > > > Jorge E. Espada  
> > > > > > Phone: +54 9 341 5692435
> > > > > 
> > > > > --  
> > > > > Opscode, Inc.  
> > > > > Adam Jacob, Chief Product Officer  
> > > > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
> > > 
> > > --  
> > > Opscode, Inc.  
> > > Adam Jacob, Chief Product Officer  
> > > T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

--  
Opscode, Inc.  
Adam Jacob, Chief Product Officer  
T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)
