L23 – Create an Environment
$ cd chef-repo
we will use a ruby file rather than a JSON file for this example
To get current recipe versions we can look at, for example, chef-repo/cookbooks/apache/metadata.rb, and we will see a verion number defined.
$mkdir environments
$cd environments
$vi devenv1.rbname “devenv1”
description “A dev environment” cookbook “apache”, “= 0.1.2” override_attributes({ “author” => { “name” => “a n author” }) Â i.e.
relies on apache cookbook v 0.1.2, whereas production is using 0.1.0
The attribute in an attribute file would look like, default[“author”][“name”] = “A different author”
So we would define all specific DEV attributes in this file and they would override the same attributes defined in the attributes files of the recipe. Â $knife environment list -w
_default: …..
$knife environment from file devenv.rb
On Node
$ cd /etc/chef$ vi client.rb and ADD
environment “devenv”
$ chef-client  fails as the apache version 0.1.5 does not yet exist  Â
Â
Â
Discussion ¬