# Question about chef environments and attributes

**URL:** <https://discourse.chef.io/t/question-about-chef-environments-and-attributes/4551>\
**Category:** Chef Infra (archive)\
**Created:** [October 11, 2013, 12:45am UTC](https://discourse.chef.io/t/question-about-chef-environments-and-attributes/4551 "2013-10-11T00:45:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jennifer\_Fountain](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jennifer_fountain/32/63_2.png) [@Jennifer\_Fountain](https://discourse.chef.io/u/Jennifer_Fountain)\
**Post date:** [October 11, 2013, 12:45am UTC](https://discourse.chef.io/t/question-about-chef-environments-and-attributes/4551/1 "2013-10-11T00:45:35Z")

</div>

We have Production, Test and Development environments setup on our Chef Servers. I would like to set attributes for each environment in attributes files like this:

default.rb contains default[:redis][:server]='redis1’  
Production.rb contains default[:redis][:server]='redis1.prod’  
Development contains default[:redis][:server]='redis1.dev’  
Test contains default[:redis][:server]=‘redis1.test’

Am I understanding attributes correctly and this will work?

Thanks for any info!  
Jenn

---

<div class="post-metadata">

**Author:** ![Joshua\_Miller1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/joshua_miller1/32/349_2.png) [@Joshua\_Miller1](https://discourse.chef.io/u/Joshua_Miller1)\
**Post date:** [October 11, 2013, 3:40am UTC](https://discourse.chef.io/t/question-about-chef-environments-and-attributes/4551/2 "2013-10-11T03:40:04Z")

</div>

Almost. The syntax for setting attributes in environments is different  
than that of setting attributes in a cookbook.

For example, your production environment would have:  
default\_attributes(  
"redis" =\> {  
"server" =\> "redis1.prod"  
}  
)

On Thu, Oct 10, 2013 at 5:45 PM, Jenn Fountain [jfountain@meetme.com](mailto:jfountain@meetme.com) wrote:

> We have Production, Test and Development environments setup on our Chef  
> Servers. I would like to set attributes for each environment in attributes  
> files like this:
> 
> default.rb contains default[:redis][:server]='redis1'  
> Production.rb contains default[:redis][:server]='redis1.prod'  
> Development contains default[:redis][:server]='redis1.dev'  
> Test contains default[:redis][:server]='redis1.test'
> 
> Am I understanding attributes correctly and this will work?
> 
> Thanks for any info!  
> Jenn
