configuration version variable?

761 views
Skip to first unread message

psychobyte

unread,
Apr 6, 2012, 12:54:50 PM4/6/12
to puppet...@googlegroups.com
Hi,

is there a fact or variable for the configuration version that I can access from hiera or my manifests? I'd like to embed it into my files.

Thanks,

Patrick Debois

unread,
Apr 6, 2012, 12:58:20 PM4/6/12
to puppet...@googlegroups.com
I've implemented that - See pull request -
https://github.com/puppetlabs/hiera-puppet/pull/20

See
https://github.com/jedi4ever/hiera-puppet/commit/2250a9825ea3382bb0518d77c4f5a8b97667f4a0
for details

> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/y9V2HDKg-YQJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

psychobyte

unread,
Apr 6, 2012, 1:12:40 PM4/6/12
to puppet...@googlegroups.com
Thanks for the reply Patrick but, I should have been more specific.

I wanted the "puppet configuration version" as in

info: Applying configuration version '1333729957'

So any file that gets manipulated by puppet has it in a header.

Thanks.


On Friday, April 6, 2012 9:58:20 AM UTC-7, Patrick Debois wrote:

On 06/04/12 18:54, psychobyte wrote:
> Hi,
>
> is there a fact or variable for the configuration version that I can
> access from hiera or my manifests? I'd like to embed it into my files.
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/y9V2HDKg-YQJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to

> puppet-users+unsubscribe@googlegroups.com.

John Warburton

unread,
Apr 10, 2012, 1:49:42 AM4/10/12
to puppet...@googlegroups.com
On 7 April 2012 03:12, psychobyte <psych...@gmail.com> wrote:
Thanks for the reply Patrick but, I should have been more specific.

I wanted the "puppet configuration version" as in

info: Applying configuration version '1333729957'

So any file that gets manipulated by puppet has it in a header.


This is a good question - its been on my to do list for a while.

http://docs.puppetlabs.com/guides/faq.html#are-there-variables-available-other-than-those-provided-by-facter

ok - looks good

% vi local_puppet_info.erb
#
# Puppet server:
    modulepath:  <%= scope.lookupvar('settings::modulepath') %>
    manifest:    <%= scope.lookupvar('settings::manifest') %>
    manifestdir: <%= scope.lookupvar('settings::manifestdir') %>
    config_version:  <%= scope.lookupvar('settings::config_version') %>

yields:
#
# Puppet server:
    modulepath:  /local/file-repo/lab/modules
    manifest:    /local/file-repo/lab/manifests/site.pp
    manifestdir: /local/file-repo/lab/manifests
    config_version:  cat /local/file-repo/lab/version

Oh noes - well its correct but doesn't return what I really want:

info: Applying configuration version 'lab-r49068'

I suspect Patrick's hiera magic may have the same issue

Any suggestions where we go from here?

John




psyber

unread,
Apr 10, 2012, 7:05:20 PM4/10/12
to puppet...@googlegroups.com
Looking for ideas here:
I wanted to provide the last run time for puppet in the MOTD and thought
it would be easy to do as a fact and it was.
I have that working but as a side effect puppet-dashboard shows all
hosts as changed because the MOTD file changes with each factor run. I
took out that line and they all still show changed because the
mcollective/facts.yaml file has all the facts in it and it changes every
run.
I really want to be able to see what hosts get changed so having
something that changes every run is not good.

Is there a better way to get the last run time and display it on a login?
Is there a way in puppet-dashboard to ignore certain changes (this isn't
the first time this issue has come up).

thanks!

Gary Larizza

unread,
Apr 10, 2012, 8:00:45 PM4/10/12
to puppet...@googlegroups.com
Hey,

In Puppet Enterprise, we have a cronjob that runs every 15 minutes that does a `facter --yaml` and redirects to a file on disk. This file is what MCollective reads for fact information. You could also add the --puppet flag that will use Puppet's $vardir for custom fact information.  Puppet would then just ensure that the cronjob was installed.  That would solve the problem of Puppet changing this file on every run.

As far as I'm aware, I don't believe there's a method of having the Dashboard ignore an event.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@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.




--

Gary Larizza
Professional Services Engineer
Puppet Labs

Reply all
Reply to author
Forward
0 new messages