Ask Your Question

Need two puppet runs for a fact to show up on master?

asked 2015-02-10 14:43:42 -0600

Thomas.Edgar gravatar image

It seems two puppet runs are necessary for a fact to show up on master. We want to use this to that after a deployment (via Jenkins) we have verification that a version of S/W has been deployed to a target node.

So we drop facts in /etc/puppetlabs/puppet/facter/facts.d (which facter picks up when run), and below is the API we are using to verify. It works - but seems to require two puppet runs for it to be visible to the puppet master (I recall seeing at the last puppet conference, others having this issue). Here is the curl command that works - albeit after two puppet runs:

curl -X GET http://localhost:8080/v3/facts/version --data-urlencode 'query=["=", "certname", ""]'

[ {
  "certname" : "",
  "name" : "version",
  "value" : "0.0.16-0"
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-10 15:55:13 -0600

lorcutt gravatar image

That is true if you are using an "external fact" like that. The first run places the information in the facts.d directory after the facts have already been generated for that run. The second run will then generate facts from that information.

The other way to handle facts if this is a problem is to write custom facts in ruby. When puppet runs, it will usually download ruby fact code first (if pluginsync is enabled), then run those ruby facts and pass them back to the master to use in compiling the catalog. This way the information from those facts is included in the catalog compilation on the first run.

Hope that helps.

edit flag offensive delete link more


I think you'd still see the issue with a custom Ruby fact. It still resolves and sends all facts first, before installing/upgrading the software. You might have to instead inspect the latest report rather than the facts.

Nick gravatar imageNick ( 2015-02-13 10:56:07 -0600 )edit

Lorcutt, Suppose if I have many agents which does not have pluginsync = true in their config files. How do I enable it on all of them? Do I have to do it manually on each agent?

udaysagar gravatar imageudaysagar ( 2015-09-07 14:06:02 -0600 )edit

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-02-10 14:43:42 -0600

Seen: 101 times

Last updated: Feb 10 '15