Ask Your Question

Can I add a custom fact on clients with info from the master?

asked 2013-03-21 14:53:05 -0600

Ash gravatar image

updated 2013-03-21 17:22:51 -0600

Stefan gravatar image

I have a dB on the master with client server info. I need to define custom facts on the clients using this info.

Can custom facts be setup in the clients puppet.conf or via the External Node Classifier?

PE 2.7.2

edit retag flag offensive close merge delete


I want to be able to filter by custom fact when using mcollective agents. The fact is whether the system is still being built, or has gone live. This info ...(more)

Ash gravatar imageAsh ( 2013-03-21 18:30:41 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-21 17:22:14 -0600

Stefan gravatar image

updated 2013-03-22 04:20:17 -0600

The intention behind facts are that the master can get information about the agent only the agent is aware of and that the master cannot know himself (like the agent's operating system or its uptime). It sounds weired that you now want to control the factvalue by your master.

It looks like you want to define a custom function. A custom function runs on your master so you can do your database lookup there and then use the returnvalue in your puppet manifest:

So the question is: What do you actually try ... (more)

edit flag offensive delete link more

answered 2013-05-23 07:16:11 -0600

Thomas Rasmussen gravatar image

I have the same problem, and in fact it seems as though a custom function is the way to go. I have created a function which can read a file, look for my FQDN and return a value for this key (simple space-separated file). My function is this:

  module Puppet::Parser::Functions
  newfunction(:get_customer_name, :type => :rvalue) do |args|
    fqdn = args[0]
    filename = "/tmp/customers.txt"
    custname="UNKNOWN","r").each_line do |line|
      if host==fqdn then
    # we return custname here

I then have ... (more)

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: 2013-03-21 14:53:05 -0600

Seen: 3,053 times

Last updated: May 23 '13