John Kennedy
2012-May-02 10:59 UTC
[Puppet Users] Using fact to determine node environment
We have a custom fact that we wrote to determine which (business) environment a specific server belongs to (test, stage, production). We want to set up puppet environments (again, test, stage, and production). Is it possible to use our custom fact to set which environment a node belongs to? Thanks, John John Kennedy -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-May-02 11:19 UTC
Re: [Puppet Users] Using fact to determine node environment
----- Original Message -----> From: "John Kennedy" <skebi69@gmail.com> > To: puppet-users@googlegroups.com > Sent: Wednesday, May 2, 2012 11:59:49 AM > Subject: [Puppet Users] Using fact to determine node environment > > We have a custom fact that we wrote to determine which (business) > environment a specific server belongs to (test, stage, production). > We want to set up puppet environments (again, test, stage, and > production). > Is it possible to use our custom fact to set which environment a node > belongs to?your only option at present is to write out puppet.conf using a template with your fact -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan Carley
2012-May-02 11:42 UTC
Re: [Puppet Users] Using fact to determine node environment
On 2 May 2012 12:19, R.I.Pienaar <rip@devco.net> wrote:> > your only option at present is to write out puppet.conf using a template > with your factWe use this approach. The very first run gets called with "--environment foo" and it sticks. "--environment" can then be called again if it needs to move to another environment/branch. "puppet.conf" simply contains: # Make environment "sticky" with each run. # Populated by `environment` variable from Facter. environment = <%= @environment %> -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2012-May-02 15:10 UTC
Re: [Puppet Users] Using fact to determine node environment
On Wed, May 2, 2012 at 4:19 AM, R.I.Pienaar <rip@devco.net> wrote:> > > ----- Original Message ----- > > From: "John Kennedy" <skebi69@gmail.com> > > To: puppet-users@googlegroups.com > > Sent: Wednesday, May 2, 2012 11:59:49 AM > > Subject: [Puppet Users] Using fact to determine node environment > > > > We have a custom fact that we wrote to determine which (business) > > environment a specific server belongs to (test, stage, production). > > We want to set up puppet environments (again, test, stage, and > > production). > > Is it possible to use our custom fact to set which environment a node > > belongs to? > > your only option at present is to write out puppet.conf using a template > with your fact > >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. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
John Kennedy
2012-May-02 15:15 UTC
Re: [Puppet Users] Using fact to determine node environment
On Wed, May 2, 2012 at 11:10 AM, Nigel Kersten <nigel@puppetlabs.com> wrote:> > > On Wed, May 2, 2012 at 4:19 AM, R.I.Pienaar <rip@devco.net> wrote: > >> >> >> ----- Original Message ----- >> > From: "John Kennedy" <skebi69@gmail.com> >> > To: puppet-users@googlegroups.com >> > Sent: Wednesday, May 2, 2012 11:59:49 AM >> > Subject: [Puppet Users] Using fact to determine node environment >> > >> > We have a custom fact that we wrote to determine which (business) >> > environment a specific server belongs to (test, stage, production). >> > We want to set up puppet environments (again, test, stage, and >> > production). >> > Is it possible to use our custom fact to set which environment a node >> > belongs to? >> >> your only option at present is to write out puppet.conf using a template >> with your fact >> >> > 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. > >Nigel, Thanks for the response. How can I use that fact to set the environment of a node? John -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-May-02 15:18 UTC
Re: [Puppet Users] Using fact to determine node environment
----- Original Message -----> From: "Nigel Kersten" <nigel@puppetlabs.com> > To: puppet-users@googlegroups.com > Sent: Wednesday, May 2, 2012 4:10:16 PM > Subject: Re: [Puppet Users] Using fact to determine node environment > > > > > On Wed, May 2, 2012 at 4:19 AM, R.I.Pienaar < rip@devco.net > wrote: > > > > > > ----- Original Message ----- > > From: "John Kennedy" < skebi69@gmail.com > > > To: puppet-users@googlegroups.com > > Sent: Wednesday, May 2, 2012 11:59:49 AM > > Subject: [Puppet Users] Using fact to determine node environment > > > > We have a custom fact that we wrote to determine which (business) > > environment a specific server belongs to (test, stage, production). > > We want to set up puppet environments (again, test, stage, and > > production). > > Is it possible to use our custom fact to set which environment a > > node > > belongs to? > > your only option at present is to write out puppet.conf using a > template > with your fact > > > > > 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 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2012-May-02 15:24 UTC
Re: [Puppet Users] Using fact to determine node environment
On Wed, May 2, 2012 at 8:18 AM, R.I.Pienaar <rip@devco.net> wrote:> > > ----- Original Message ----- > > From: "Nigel Kersten" <nigel@puppetlabs.com> > > To: puppet-users@googlegroups.com > > Sent: Wednesday, May 2, 2012 4:10:16 PM > > Subject: Re: [Puppet Users] Using fact to determine node environment > > > > > > > > > > On Wed, May 2, 2012 at 4:19 AM, R.I.Pienaar < rip@devco.net > wrote: > > > > > > > > > > > > ----- Original Message ----- > > > From: "John Kennedy" < skebi69@gmail.com > > > > To: puppet-users@googlegroups.com > > > Sent: Wednesday, May 2, 2012 11:59:49 AM > > > Subject: [Puppet Users] Using fact to determine node environment > > > > > > We have a custom fact that we wrote to determine which (business) > > > environment a specific server belongs to (test, stage, production). > > > We want to set up puppet environments (again, test, stage, and > > > production). > > > Is it possible to use our custom fact to set which environment a > > > node > > > belongs to? > > > > your only option at present is to write out puppet.conf using a > > template > > with your fact > > > > > > > > > > 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? -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-May-02 15:37 UTC
Re: [Puppet Users] Using fact to determine node environment
----- Original Message -----> From: "Nigel Kersten" <nigel@puppetlabs.com> > To: puppet-users@googlegroups.com > Sent: Wednesday, May 2, 2012 4:24:06 PM > Subject: Re: [Puppet Users] Using fact to determine node environment > > > > > On Wed, May 2, 2012 at 8:18 AM, R.I.Pienaar < rip@devco.net > wrote: > > > > > > ----- Original Message ----- > > From: "Nigel Kersten" < nigel@puppetlabs.com > > > To: puppet-users@googlegroups.com > > > > Sent: Wednesday, May 2, 2012 4:10:16 PM > > Subject: Re: [Puppet Users] Using fact to determine node > > environment > > > > > > > > > > On Wed, May 2, 2012 at 4:19 AM, R.I.Pienaar < rip@devco.net > > > wrote: > > > > > > > > > > > > ----- Original Message ----- > > > From: "John Kennedy" < skebi69@gmail.com > > > > To: puppet-users@googlegroups.com > > > Sent: Wednesday, May 2, 2012 11:59:49 AM > > > Subject: [Puppet Users] Using fact to determine node environment > > > > > > We have a custom fact that we wrote to determine which (business) > > > environment a specific server belongs to (test, stage, > > > production). > > > We want to set up puppet environments (again, test, stage, and > > > production). > > > Is it possible to use our custom fact to set which environment a > > > node > > > belongs to? > > > > your only option at present is to write out puppet.conf using a > > template > > with your fact > > > > > > > > > > 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. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2012-May-02 15:38 UTC
Re: [Puppet Users] Using fact to determine node environment
On Wed, May 2, 2012 at 8:37 AM, R.I.Pienaar <rip@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? -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-May-02 15:46 UTC
Re: [Puppet Users] Using fact to determine node environment
----- Original Message -----> From: "Nigel Kersten" <nigel@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 < rip@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-May-02 15:53 UTC
Re: [Puppet Users] Using fact to determine node environment
----- Original Message -----> From: "R.I.Pienaar" <rip@devco.net> > To: puppet-users@googlegroups.com > Sent: Wednesday, May 2, 2012 4:46:24 PM > Subject: Re: [Puppet Users] Using fact to determine node environment > > > > ----- Original Message ----- > > From: "Nigel Kersten" <nigel@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 < rip@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 pastshould say I am on 2.6.x here, this may well have been fixed in 2.7.x -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2012-May-02 18:43 UTC
Re: [Puppet Users] Using fact to determine node environment
On Wed, May 2, 2012 at 8:53 AM, R.I.Pienaar <rip@devco.net> wrote:> > > > > 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 > > should say I am on 2.6.x here, this may well have been fixed in 2.7.xThat''s the puzzling bit. It was definitely working for me in production in earlier 2.6.x days. I just tested with 2.7.x and it''s broken too. I''ll go hunting through the bug tracker today and update the bug or file a new one. Frustrating. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.