I am using a simple puppet setup for a large number of servers. Puppet gets information from a CMDB using External Node Classifiers. This works perfectly.

After each run, the Puppet master posts the status for the run to the CMDB using a custom report module. This also works great.

What I would like is Puppet to post the facts for a node after each run to the CMDB. Doing this, the CMDB could auto update things like memory, MAC address etc.

The question is; How can I achieve this?

The report mechanism only provides status and some metrics.

It's not so easy to write a custom storeconfig module (or at least I couldn't find any information regarding this).

Thanks for any help.


I created a report module in Puppet that solved this particular use case. The reporter tries to read the latest yaml report then add extra stuff to the post.

  def process
    payload = { :host => self.host, :status => self.status, :kind => self.kind }   
    # if facts file found, read it and add facts to payload:
    if File.exists?("#{Puppet[:vardir]}/yaml/facts/#{self.host}.yaml")
        new_facts = {}
        node_facts = YAML.load_file("#{Puppet[:vardir]}/yaml/facts/#{self.host}.yaml")
        node_facts.values.each do |key, value|
            new_facts = new_facts.merge({key => value})
        payload = payload.merge(new_facts)
    response = HTTParty.post(URL, :body => payload )
    Puppet.err "Response code: #{response.code} - #{response.body}" unless response.code == 200

If you want to learn more about writing custom Puppet reports, check When Puppet reports part 2


Do you have a hard requirement to have it in the single CMDB, or is the goal just to have it queryable? PuppetDB already provides an API for facts lookup:


Strictly speaking, Puppet itself doesn't know what the value of facts are at the end of the run -- only at the beginning of the run. I'm not sure what your endgame is, but since Puppet is not itself tied to the value of your facts in any way, a better solution is probably to use MCollective rather than Puppet to aggregate details about your nodes, and store them using a custom registration plugin that posts back to your CMDB.

  • 1
    PuppetDB can do the work, but this means that the CMDB must poll the puppet server. MCollective can also do the work but because the puppet nodes are spread all over the internet, this means that I have to expose ActiveMQ to the world. This does not feel comfortable. – magnusa Jun 17 '13 at 11:52
  • AMQ is the same as any other network service -- you're already exposing your Puppetmaster, right? MCollective has the ability to do two-way authentication using the TLS security plugin, in much the same manner that Puppet does. (Yeah, I saw that you wrote your own report processor already.) – jgoldschrafe Jun 17 '13 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.