Ask Your Question

Mcollective: How to access frequently changing facts?

asked 2015-07-22 15:32:35 -0600

ramindk gravatar image

We currently generate our /etc/mcollective/facts.yaml when Puppet runs. We skip over frequently changing facts like uptime. Is there a way to have Puppet run generated facts as well as a second set?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-22 15:32:49 -0600

ramindk gravatar image

Yes, you can specify multiple fact files. The syntax looks like this.

plugin.yaml = /etc/mcollective/facts.yaml:/etc/mcollective/cron_facts.yaml

We generate facts.yaml during the Puppet run and cron_facts.yaml via cron. We can now use mcollective to find machines based on length of uptime, RAM usage or any number of quickly changing facts we don't want generating noise in the catalog. Your code might looks like

  package { 'mcollective':
    ensure => $mcollective::data::version,
    name   => $mcollective::local::packagename,

  file { '/etc/mcollective/facts.yaml':
    ensure  => file,
    mode    => '0400',
    content => template('mcollective/facts.yaml.erb'),
    require => Package['mcollective'],

  file { '/etc/mcollective/cron_facts.rb':
    ensure  => file,
    mode    => '0750',
    content => template('mcollective/cron_facts.rb.erb'),
    require => Package['mcollective'],

  cron::simple { 'mcollective cron_facts.yaml':
    cron_user => 'root',
    payload   => '/etc/mcollective/cron_facts.rb > /dev/null 2>&1',
    minutes   => '*/15',
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-07-22 15:32:35 -0600

Seen: 193 times

Last updated: Jul 22 '15