Foreman ENC puppet environment mismatch

It's a known Puppet issue, and the effects can be subtle. As far as I
know, workarounds involve either not passing the environment in the
ENC data (so the client always wins), or having an ENC smart enough to
detect the mismatch and do something clever like returning an updated
puppet.conf (and nothing else).

I think this is fixed properly in Puppet 3, but there are other bugs
with that at the moment. Your mileage may vary :slight_smile:

Greg

··· On 11 October 2012 16:02, puppet-foreman wrote: > I've seen assorted issues with the environment being defined in foreman and > handled via ENC not being propagated properly. > > I read a lot of configuration / build information from this site: > http://seriousbirder.com/blogs/puppet-master-server-and-foreman-console-configuration-guide/ > > and managed to get my puppet master working perfectly with 50+ client nodes, > all good. > > My issue is when in foreman I change an environment from the console the > changes are reflected. But when the client agent runs, it thinks its in the > production environment which is the default in my puppet.conf master file. > > Is this a puppet or foreman issue? Is the puppet issue > > http://projects.puppetlabs.com/issues/3910

> > I've seen assorted issues with the environment being defined in foreman
> and
> > handled via ENC not being propagated properly.
> >
> > I read a lot of configuration / build information from this site:
> >
> http://seriousbirder.com/blogs/puppet-master-server-and-foreman-console-configuration-guide/
> >
> > and managed to get my puppet master working perfectly with 50+ client
> nodes,
> > all good.
> >
> > My issue is when in foreman I change an environment from the console the
> > changes are reflected. But when the client agent runs, it thinks its in
> the
> > production environment which is the default in my puppet.conf master
> file.
> >
> > Is this a puppet or foreman issue? Is the puppet issue
> >
> > http://projects.puppetlabs.com/issues/3910
>
>
> It's a known Puppet issue, and the effects can be subtle. As far as I
> know, workarounds involve either not passing the environment in the
> ENC data (so the client always wins), or having an ENC smart enough to
> detect the mismatch and do something clever like returning an updated
> puppet.conf (and nothing else).
>

yes, thats why foreman has the following option:

enc_environment defaults to false Should Foreman provide puppet
environment in ENC yaml output? (this avoids the mismatch error between
puppet.conf and ENC environment)

Ohad

··· On Thu, Oct 11, 2012 at 5:38 PM, Greg Sutcliffe wrote: > On 11 October 2012 16:02, puppet-foreman wrote:

I think this is fixed properly in Puppet 3, but there are other bugs
with that at the moment. Your mileage may vary :slight_smile:

Greg


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

Hi Ohad,
I as well am having this issue and when I set the enc_environment in
settings.yaml to true, the problem persists. I want to be able to set the
environment in foreman, i.e, to "testing" and not have to set it in the
client puppet.conf. Now, the foreman_env is set correctly to testing and
the module runs but it is still following "production" modulepath for
files. Even thought the environment shows as testing, it still searches
the production modulepath. Here is the settings.yaml:

classes:
- banner
- motd
parameters:
foreman_env: &id001 testing
puppetmaster: puppet
owner_email: root@
owner_name: Admin User
hostgroup: testing
environment: *id001

puppet --configprint all |grep env
environment = production

very confusing…
Bru.

··· On Thursday, 11 October 2012 11:43:00 UTC-4, ohad wrote: > > > > On Thu, Oct 11, 2012 at 5:38 PM, Greg Sutcliffe <greg.su...@gmail.com > > wrote: > >> On 11 October 2012 16:02, puppet-foreman <trad...@gmail.com > >> wrote: >> > I've seen assorted issues with the environment being defined in foreman >> and >> > handled via ENC not being propagated properly. >> > >> > I read a lot of configuration / build information from this site: >> > >> http://seriousbirder.com/blogs/puppet-master-server-and-foreman-console-configuration-guide/ >> > >> > and managed to get my puppet master working perfectly with 50+ client >> nodes, >> > all good. >> > >> > My issue is when in foreman I change an environment from the console the >> > changes are reflected. But when the client agent runs, it thinks its in >> the >> > production environment which is the default in my puppet.conf master >> file. >> > >> > Is this a puppet or foreman issue? Is the puppet issue >> > >> > http://projects.puppetlabs.com/issues/3910 >> >> >> It's a known Puppet issue, and the effects can be subtle. As far as I >> know, workarounds involve either not passing the environment in the >> ENC data (so the client always wins), or having an ENC smart enough to >> detect the mismatch and do something clever like returning an updated >> puppet.conf (and nothing else). >> > > yes, thats why foreman has the following option: > > enc_environment defaults to false Should Foreman provide puppet > environment in ENC yaml output? (this avoids the mismatch error between > puppet.conf and ENC environment) > > Ohad > >> >> I think this is fixed properly in Puppet 3, but there are other bugs >> with that at the moment. Your mileage may vary :) >> >> Greg >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To post to this group, send email to forema...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> foreman-user...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/foreman-users?hl=en. >> >> >

Unfortunately, this is a bug in puppet, so there isn't much that can be
done about it right now.

It has been fixed in Puppet 3.0 (ENC always wins in a conflict), but there
are other issues with puppet 3 and The Foreman, but hopefully those will be
resolved soon as well.

··· On Friday, October 12, 2012 1:27:29 PM UTC-5, brufan wrote: > > Hi Ohad, > I as well am having this issue and when I set the enc_environment in > settings.yaml to true, the problem persists. I want to be able to set the > environment in foreman, i.e, to "testing" and not have to set it in the > client puppet.conf. Now, the foreman_env is set correctly to testing and > the module runs but it is still following "production" modulepath for > files. Even thought the environment shows as testing, it still searches > the production modulepath. Here is the settings.yaml: > >

> Hi Ohad,
> I as well am having this issue and when I set the enc_environment in
> settings.yaml to true,

nope, goto more -> settings

Ohad

··· On Fri, Oct 12, 2012 at 8:27 PM, brufan wrote:

the problem persists. I want to be able to set the environment in
foreman, i.e, to “testing” and not have to set it in the client
puppet.conf. Now, the foreman_env is set correctly to testing and the
module runs but it is still following “production” modulepath for files.
Even thought the environment shows as testing, it still searches the
production modulepath. Here is the settings.yaml:

classes:
- banner
- motd
parameters:
foreman_env: &id001 testing
puppetmaster: puppet
owner_email: root@
owner_name: Admin User
hostgroup: testing
environment: *id001

puppet --configprint all |grep env
environment = production

very confusing…
Bru.

On Thursday, 11 October 2012 11:43:00 UTC-4, ohad wrote:

On Thu, Oct 11, 2012 at 5:38 PM, Greg Sutcliffe greg.su...@gmail.comwrote:

On 11 October 2012 16:02, puppet-foreman trad...@gmail.com wrote:

I’ve seen assorted issues with the environment being defined in
foreman and
handled via ENC not being propagated properly.

I read a lot of configuration / build information from this site:
http://seriousbirder.com/blogs/puppet-master-server-
and-foreman-console-**configuration-guide/http://seriousbirder.com/blogs/puppet-master-server-and-foreman-console-configuration-guide/

and managed to get my puppet master working perfectly with 50+ client
nodes,
all good.

My issue is when in foreman I change an environment from the console
the
changes are reflected. But when the client agent runs, it thinks its
in the
production environment which is the default in my puppet.conf master
file.

Is this a puppet or foreman issue? Is the puppet issue

http://projects.puppetlabs.**com/issues/3910http://projects.puppetlabs.com/issues/3910

It’s a known Puppet issue, and the effects can be subtle. As far as I
know, workarounds involve either not passing the environment in the
ENC data (so the client always wins), or having an ENC smart enough to
detect the mismatch and do something clever like returning an updated
puppet.conf (and nothing else).

yes, thats why foreman has the following option:

enc_environment defaults to false Should Foreman provide puppet
environment in ENC yaml output? (this avoids the mismatch error between
puppet.conf and ENC environment)

Ohad

I think this is fixed properly in Puppet 3, but there are other bugs
with that at the moment. Your mileage may vary :slight_smile:

Greg


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To post to this group, send email to forema...@googlegroups.com**.
To unsubscribe from this group, send email to foreman-user…@**
googlegroups.com.

For more options, visit this group at http://groups.google.com/**
group/foreman-users?hl=enhttp://groups.google.com/group/foreman-users?hl=en
.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/5qch8Abe9TsJ.

To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

ok. I will have to hardcode the env in the client puppet.conf then.
Thanks for the quick response!
Brufan.

··· On Friday, 12 October 2012 14:35:31 UTC-4, llowder wrote: > > > > On Friday, October 12, 2012 1:27:29 PM UTC-5, brufan wrote: >> >> Hi Ohad, >> I as well am having this issue and when I set the enc_environment in >> settings.yaml to true, the problem persists. I want to be able to set the >> environment in foreman, i.e, to "testing" and not have to set it in the >> client puppet.conf. Now, the foreman_env is set correctly to testing and >> the module runs but it is still following "production" modulepath for >> files. Even thought the environment shows as testing, it still searches >> the production modulepath. Here is the settings.yaml: >> >> > > Unfortunately, this is a bug in puppet, so there isn't much that can be > done about it right now. > > It has been fixed in Puppet 3.0 (ENC always wins in a conflict), but there > are other issues with puppet 3 and The Foreman, but hopefully those will be > resolved soon as well. > >

If you've got a module that manages your puppet agents add something
like this to your manifest:

Get wanted environment from Foreman ENC:

if $::foreman_env {
$environment = $::foreman_env
} else {
# fall back to environment fact.
$environment = $::environment
}

file { "/etc/puppet/puppet.conf":
content => template("puppet/agent/puppet.conf.erb")

}

and this to files/agent/puppet.conf.erb:

environment = <%= scope.lookupvar('puppet::environment') %>

It will make the puppet agent change environment to the one provided
by the ENC. Unfortunately it means a full environment transition + run
in new environment will take two runs.

Or don't do this and wait for Puppet 3.0 to work … :slight_smile:

··· On Fri, Oct 12, 2012 at 8:42 PM, brufan wrote: > ok. I will have to hardcode the env in the client puppet.conf then. Thanks > for the quick response! > Brufan.