- From:
- To:
- Subject: [chef] Re: Re: Re: Re: using env attr to override a default
- Date: Tue, 27 Sep 2011 15:04:31 -0700
On Tue, 27 Sep 2011, andi abes wrote:
>
silly question - are your nodes actually assigned to the different
>
environments?
not silly, cuz i do silly things sometimes. but i think my env is set
correctly:
test node which i desire to be a mail-client:
[sous-chef1-dev ~]# grep environment /etc/chef/client.rb
environment "dev"
again, mail-client should pick up the env override for relayhost
as "mungbeans.dev.dorqtown.com" instead of the default value from
the recipe attributes. but it's not.
test node which i desire to be a mail-server:
[sous-chef2-dev ~]# grep environment /etc/chef/client.rb
environment "dev"
in debug output, i do see it seeking out env info.
[Tue, 27 Sep 2011 18:15:50 +0000] DEBUG: Sending HTTP Request via POST to
10.2.7.238:4000/environments/dev/cookbook_versions
[Tue, 27 Sep 2011 18:15:51 +0000] DEBUG: Sending HTTP Request via GET to
10.2.7.238:4000/environments/dev
and fwiw, the chef clients are CentOS 5.6, running 0.10.4, RPMs
from RBEL (e.g. rubygem-chef-0.10.4-1.el5).
i'm running my own chef server, Ubuntu 11.04, 0.10.4-1.
>
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
>
> relayhost = mailrelay.dev.dorqtown.com
>
>
>
>
>
> where to look?
>
>
>
>
Archive powered by MHonArc 2.6.16.