Custom facts are updated in the next execution of "puppet agent --test"

30 views
Skip to first unread message

Amrit Atmajit

unread,
Jul 12, 2016, 3:14:30 AM7/12/16
to Puppet Users
Hi,

I am using following code snippet in one of the init.pp file of puppet master to load the updated facts in "facts.yaml" available in "C:\marionette-collective\etc\" folder.

 

  file { "c:/marionette-collective/etc/facts.yaml":

    loglevel => debug,

    content  => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|timestamp|free)/}.to_yaml %>"),

    require   => [ Exec['set_executionpolicy'], Exec['gencustomfacts'] ],

  }



But, the custom facts are getting updated in facts.yaml file on execution of next "puppet agent --test", not immediately.

Am I missing something to update the facts.yaml for the custom facts on the immediate execution of "puppet agent --test" not on the next execution?

Regards
Amrit

Rob Nelson

unread,
Jul 12, 2016, 7:02:32 AM7/12/16
to puppet...@googlegroups.com
Amrit, since you are deploying it as a file resource, it has to be deployed to the agent before it will be used. You could instead add the fact to your module, where plugin sync will push it to the agent before it collects facts, which means it is there on the first facts run. See https://docs.puppet.com/facter/3.1/custom_facts.html#fact-locations
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/060a4391-03a0-4074-b322-72a7784fcab0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Reply all
Reply to author
Forward
0 new messages