Question about chef environments and attributes


#1

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


#2

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