----- Original Message ----- > From: "Nigel Kersten" <ni...@puppetlabs.com> > To: puppet-users@googlegroups.com > Sent: Wednesday, May 2, 2012 4:38:38 PM > Subject: Re: [Puppet Users] Using fact to determine node environment > > > > > On Wed, May 2, 2012 at 8:37 AM, R.I.Pienaar < r...@devco.net > wrote: > > > > > > > > > Unless something broke it recently, I ran for years with a fact > > > that > > > returned ":environment" and didn't set it in puppet.conf at all. > > > > yes, it broke. You'll get a mix of files from one environment and > > classes > > from another etc, puppet.conf is the only option now > > > > > > > > > > I think you're thinking of the ENC setting the environment, not a > > fact called 'environment' RI? > > nope. > > > > > > Anyone got a bug # for this?
pretty sure there was one but couldnt find it so I just knocked up a quick test, this has been discussed to death in the past . ├── development │ ├── modules │ │ └── test │ │ ├── files │ │ │ └── envtest │ │ └── manifests │ │ └── init.pp │ └── site.pp ├── production │ ├── modules │ │ └── test │ │ ├── files │ │ │ └── envtest │ │ └── manifests │ │ └── init.pp │ └── site.pp ├── puppet.conf └── test.pp test.pp has: include test production init.pp has: class test { notify{"production test": } file{"/tmp/envtest": source =>"puppet:///modules/test/envtest" } } development just changed the notify when running with --enviornment this works: % puppet apply --config puppet.conf --environment development test.pp notice: development test notice: /Stage[main]/Test/Notify[development test]/message: defined 'message' as 'development test' notice: /Stage[main]/Test/File[/tmp/envtest]/ensure: defined content as '{md5}e42d5f60192d1f8f94ce446fff3113b0' notice: Finished catalog run in 0.03 seconds % cat /tmp/envtest development % puppet apply --config puppet.conf --environment production test.pp notice: /Stage[main]/Test/File[/tmp/envtest]/content: content changed '{md5}e42d5f60192d1f8f94ce446fff3113b0' to '{md5}6f03617bce8a5d04fe97df572f273d05' notice: production test notice: /Stage[main]/Test/Notify[production test]/message: defined 'message' as 'production test' notice: Finished catalog run in 0.03 seconds % cat /tmp/envtest production same with a fact and here i am getting development code with production files: % FACTER_environment=development puppet apply --config puppet.conf test.pp notice: development test notice: /Stage[main]/Test/Notify[development test]/message: defined 'message' as 'development test' notice: Finished catalog run in 0.02 seconds % cat /tmp/envtest production -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.