- From: Adam Jacob <
>
- To:
- Cc:
- Subject: [chef] Re: Environment-specific Data bag?
- Date: Wed, 19 Oct 2011 09:13:17 -0700
You can do this just by changing the structure of the items to include the
environment as a top level key:
{
"id": "paths"
"production": { "path": "/usr/local" },
"dev": { "path": "/usr/local"}
}
So when you de-reference it:
i = Chef::DataBagItem('bagname', 'paths')
i[node.chef_environment]["path"]
Best,
Adam
On Oct 19, 2011, at 8:40 AM, Benoit Caron wrote:
>
Is it possible to have different values in a data bag per environment?
>
>
I find it tricky to change something in the structure of a data bag: I can
>
test the cookbook changes in my dev environment, but pushing the databag to
>
my chef-server makes it available to the production nodes, which don't know
>
about the change.
>
>
This could also be a way to have different values for the respective
>
environments (like say, a different path, IP address, etc.).
>
>
Or am I using the data bag incorrectly?
>
>
Benoit
Archive powered by MHonArc 2.6.16.