Ask Your Question

Provide all Puppet master IP addresses to client nodes

asked 2013-08-22 16:37:23 -0500

Rodney gravatar image

I need a comma separated list of ALL IP addresses of a Puppet master so I can set it in a config file on the system of Puppet nodes/agents.

I can get the primary IP with $serverip, but I need all interface addresses.

Is there a way to establish a Puppet fact with this list?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-23 01:32:31 -0500

GregLarkin gravatar image

updated 2013-08-23 01:37:42 -0500

I would create an executable fact that does something like this:

/sbin/ifconfig -a | grep -w inet | awk '{ print $2 }' | tr '[\n]' '[,]' | sed -e 's/,$//'

This works on FreeBSD, but YMMV on a Linux machine. The command includes all interface aliases, which you may or may not need. I get this as the output:,,,,,,,,,,,172.16 ...
edit flag offensive delete link more


Rodney gravatar imageRodney ( 2013-08-23 08:51:13 -0500 )edit

Great, glad that helped, and I'll keep the exportfact module in mind. That looks really useful!

GregLarkin gravatar imageGregLarkin ( 2013-08-23 10:04:58 -0500 )edit

If you're using Puppet 3.X, I would highly recommend looking at the SRV record support to let the clients do the "right thing".

Trevor Vaughan gravatar imageTrevor Vaughan ( 2013-08-24 13:36:57 -0500 )edit

SRV records are for setting up a pool of masters for agents to connect to (, but I think all the OP is ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-08-24 16:53:00 -0500 )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


Asked: 2013-08-22 16:37:23 -0500

Seen: 927 times

Last updated: Aug 23 '13