--configprint

17 views
Skip to first unread message

Jonathan Gazeley

unread,
Sep 5, 2014, 9:53:54 AM9/5/14
to puppet...@googlegroups.com
Hi peeps,

I've just noticed that "puppet agent --configprint runinterval" is not
doing what I expect. Why does it misreport the environment? The node is
indeed checking into the netops environment.

[jg4461@web-team-dev ~]$ puppet agent --configprint environment
production
[jg4461@web-team-dev ~]$ cat /etc/puppet/puppet.conf
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet
syslogfacility = local5

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[agent]
# enable Puppet Dashboard reports
#report = true

# Sync plugins, such as custom facts
pluginsync = true

# Run every 10 minutes rather than the default 30
runinterval = 60m

# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

environment = netops

R.I.Pienaar

unread,
Sep 5, 2014, 10:02:51 AM9/5/14
to puppet-users


----- Original Message -----
> From: "Jonathan Gazeley" <Jonathan...@bristol.ac.uk>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Friday, September 5, 2014 2:53:27 PM
> Subject: [Puppet Users] --configprint

> Hi peeps,
>
> I've just noticed that "puppet agent --configprint runinterval" is not
> doing what I expect. Why does it misreport the environment? The node is
> indeed checking into the netops environment.
>
> [jg4461@web-team-dev ~]$ puppet agent --configprint environment
> production

Try it as root.

Jonathan Gazeley

unread,
Sep 5, 2014, 10:59:54 AM9/5/14
to puppet...@googlegroups.com
OK, that gives the expected output. My question is based on this custom
fact:

https://gist.github.com/hunner/1989071

MCollective caches the fact as non-root and so I am unable to match on
environment when using mco.

Any suggestions?

Thanks,
Jonathan

R.I.Pienaar

unread,
Sep 5, 2014, 11:05:08 AM9/5/14
to puppet-users
Use the preferred method where in a manifest you dump out the facts to a yaml
file for mcollective to use.

the method you posted there won't work reliably anymore as the node isnt the
only thing in charge of its environment - the master and ENC can now override
it.

https://docs.puppetlabs.com/mcollective/deploy/standard.html#populate-the-fact-file

Jonathan Gazeley

unread,
Sep 5, 2014, 11:09:48 AM9/5/14
to puppet...@googlegroups.com
I'm using puppetlabs-mcollective to configure our MCollective bits. Basically a completely stock installation, and facts.yaml is written out each puppet run. However it includes the environment you expect when not running as root.


the method you posted there won't work reliably anymore as the node isnt the
only thing in charge of its environment - the master and ENC can now override
it.
OK. We are not using master or ENC environment setting yet. Would this custom fact work any better?

Facter.add("environment) do
  setcode do
    Puppet[:environment]
  end
end

    

R.I.Pienaar

unread,
Sep 5, 2014, 11:21:09 AM9/5/14
to puppet-users
The way it's doing it, I'd say you just cant rely on it then.

>>
>> the method you posted there won't work reliably anymore as the node isnt the
>> only thing in charge of its environment - the master and ENC can now override
>> it.
> OK. We are not using master or ENC environment setting yet. Would this
> custom fact work any better?
>
> Facter.add("environment) do
> setcode do
> Puppet[:environment]
> end
> end

nope, but for this you could probably set environment=foo in [main] in puppet.conf
and might work better then

Jonathan Gazeley

unread,
Sep 5, 2014, 11:40:10 AM9/5/14
to puppet...@googlegroups.com
Hmm, OK. Maybe I should step back and ask a more general question.
What's the best way to use MCollective to match environments, e.g. so I
can trigger a Puppet run on all my dev boxes?

Heading home for the weekend now, but I'll pick this up on Monday.

Thanks,
Jonathan

R.I.Pienaar

unread,
Sep 5, 2014, 11:47:49 AM9/5/14
to puppet-users

Jonathan Gazeley

unread,
Sep 8, 2014, 4:37:30 AM9/8/14
to puppet...@googlegroups.com
OK. I'm using puppetlabs/mcollective which seems to populate facts.yaml
on its own. Does that mean your example is not necessary in my case?
Reply all
Reply to author
Forward
0 new messages