Ask Your Question

How can I adjust a template to use custom variables that are delivered from each client?

asked 2013-12-13 03:35:04 -0500

Marco gravatar image

updated 2013-12-13 03:36:00 -0500


I am quite new to puppet and I want to determine what I have to do to make it work. Currently we are using package based configurations, and I want to change that to make things easier in the future. Following scenario:

We have an Active Directory and many Linux Clients that are using SSSD and Kerberos for authentication. In the sssd.conf is a parameter "ldap_uri". The parameter has 2 servers as values. The servers itself are obtained with the command on the client side:

host -N 2 -t SRV | grep -v NXDOMAIN | awk ... (more)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-12-13 03:55:09 -0500

golja gravatar image

In your case I would use an custom fact and name it ldapuri, so whenever the client send the request to the master it will also send the right ldapuri.

So for example:

# ldap_uri.rb

Facter.add("ldap_uri") do
  setcode do
    Facter::Util::Resolution.exec('/usr/bin/host -N 2 -t SRV | grep -v NXDOMAIN | awk '{print $NF}' | sed 's/'net.'/'net'/g'')


Master will treat ldapuri as another global variable accessible by $::ldapuri, so you can use it in your template. For more information have a look at the official documentation.

edit flag offensive delete link more

answered 2013-12-15 03:20:38 -0500

zwopiR gravatar image

there are DNS query functions made by the spotify guys (search in slideshare, there is a nice presentation about puppet@spotify) So you can get the values on the puppet master an use them in your template sssd.conf.erb (or whatever it is called)

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-12-13 03:35:04 -0500

Seen: 147 times

Last updated: Dec 15 '13