Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Using fact to determine node environment
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Kennedy  
View profile  
 More options May 2 2012, 6:59 am
From: John Kennedy <skeb...@gmail.com>
Date: Wed, 2 May 2012 06:59:49 -0400
Local: Wed, May 2 2012 6:59 am
Subject: 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options May 2 2012, 7:19 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Wed, 2 May 2012 12:19:34 +0100 (BST)
Local: Wed, May 2 2012 7:19 am
Subject: Re: [Puppet Users] Using fact to determine node environment

----- Original Message -----
> From: "John Kennedy" <skeb...@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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Carley  
View profile  
 More options May 2 2012, 7:42 am
From: Dan Carley <dan.car...@gmail.com>
Date: Wed, 2 May 2012 12:42:48 +0100
Local: Wed, May 2 2012 7:42 am
Subject: Re: [Puppet Users] Using fact to determine node environment

On 2 May 2012 12:19, R.I.Pienaar <r...@devco.net> wrote:

> your only option at present is to write out puppet.conf using a template
> with your fact

We 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options May 2 2012, 11:10 am
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Wed, 2 May 2012 08:10:16 -0700
Local: Wed, May 2 2012 11:10 am
Subject: Re: [Puppet Users] Using fact to determine node environment

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Kennedy  
View profile  
 More options May 2 2012, 11:15 am
From: John Kennedy <skeb...@gmail.com>
Date: Wed, 2 May 2012 11:15:02 -0400
Local: Wed, May 2 2012 11:15 am
Subject: Re: [Puppet Users] Using fact to determine node environment

Nigel,
Thanks for the response. How can I use that fact to set the environment of
a node?
John

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options May 2 2012, 11:18 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Wed, 2 May 2012 16:18:17 +0100 (BST)
Local: Wed, May 2 2012 11:18 am
Subject: Re: [Puppet Users] Using fact to determine node environment

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options May 2 2012, 11:24 am
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Wed, 2 May 2012 08:24:06 -0700
Local: Wed, May 2 2012 11:24 am
Subject: Re: [Puppet Users] Using fact to determine node environment

I think you're thinking of the ENC setting the environment, not a fact
called 'environment' RI?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options May 2 2012, 11:37 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Wed, 2 May 2012 16:37:36 +0100 (BST)
Local: Wed, May 2 2012 11:37 am
Subject: Re: [Puppet Users] Using fact to determine node environment

nope.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options May 2 2012, 11:38 am
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Wed, 2 May 2012 08:38:38 -0700
Local: Wed, May 2 2012 11:38 am
Subject: Re: [Puppet Users] Using fact to determine node environment

Anyone got a bug # for this?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options May 2 2012, 11:46 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Wed, 2 May 2012 16:46:24 +0100 (BST)
Local: Wed, May 2 2012 11:46 am
Subject: Re: [Puppet Users] Using fact to determine node environment

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options May 2 2012, 11:53 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Wed, 2 May 2012 16:53:38 +0100 (BST)
Local: Wed, May 2 2012 11:53 am
Subject: Re: [Puppet Users] Using fact to determine node environment

should say I am on 2.6.x here, this may well have been fixed in 2.7.x

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options May 2 2012, 2:43 pm
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Wed, 2 May 2012 11:43:35 -0700
Local: Wed, May 2 2012 2:43 pm
Subject: Re: [Puppet Users] Using fact to determine node environment

On Wed, May 2, 2012 at 8:53 AM, R.I.Pienaar <r...@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.x

That'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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »