[chef] Re: Re: Re: using env attr to override a default


Chronological Thread 
  • From: andi abes < >
  • To:
  • Subject: [chef] Re: Re: Re: using env attr to override a default
  • Date: Tue, 27 Sep 2011 17:40:10 -0400

silly question - are your nodes actually assigned to the different environments?

You've shown that you've created the environments, and the nodes' run lists, but not the nodes' environments.
see for manipulating node's env:
http://wiki.opscode.com/display/chef/Environments#Environments-SettingaNode%27sEnvironment




On Tue, Sep 27, 2011 at 2:32 PM, < "> > wrote:
On Tue, 27 Sep 2011, AJ Christensen wrote:

> Yo,
>
> Your environments attributes are wrong:
>
> On 27 September 2011 17:49,  < "> > wrote:
> >
> > first, the prod and dev environments:
> >
> >    [chef-repo]$ knife environment show dev
> >    chef_type:            environment
> >    cookbook_versions:
> >    default_attributes:
> >      mail-client:
> >        relayhost:  mungbeans.dev.dorqtown.com
> >      mail-server:
> >        relayhost:  [smtp.gmail.com]:587
> >    description:          Development environment (dev)
> >    json_class:           Chef::Environment
> >    name:                 dev
> >    override_attributes:
>
> this should be:
> default_attributes "postfix" => { "relayhost" => "whatever" }
>
> The attributes are deep merged together onto the node and thus the
> atribute structure must remain the same. Does this make sense?
>
> If you can post the on-disk, ruby version of the environment files I
> can point out the problem, otherwise good luck!

i can show you the json version of the env files. i was trying to
cobble together the ruby, but not getting it quickly. for the sake of
speed i'll show the json. i see what you're saying about attribute
structure, so i corrected it, i believe. but the client's relayhost
in main.cf is still picking up the setting from the postfix cookbook
attr setting rather than the dev env setting.

[chef-repo]$ cat environments/dev.json
{
 "name": "dev",
 "default_attributes": {
   "postfix": {
     "mail-server": {
       "relayhost": "[outbound.mailhop.org],[smtp.gmail.com]:587"
     },
     "mail-client": {
       "relayhost": "mungbeans.dev.dorqtown.com"
     }
   }
 },
 "json_class": "Chef::Environment",
 "description": "Development environment (dev)",
 "chef_type": "environment"
}

[chef-repo]$ knife node show sous-chef1.dev.dorqtown.com -r
run_list:  role[mail-client]

[sous-chef1-dev ~]# grep relayhost /etc/postfix/main.cf
where to look?





Archive powered by MHonArc 2.6.16.

§