Ask Your Question
1

Customize file with unique client information

asked 2013-10-22 13:08:26 -0600

Idavis gravatar image

My team is starting to use Puppet to configure and maintain a group of about 20 kiosk-type machines and I am wondering if there is a way to put place-holders in a file to be filled in by unique system information with Puppet. One example is with the wireless configuration file found in /etc/NetworkManager/system-connections. Here is a part of the file we are trying to customize when pushed out to the clients.

[connection]
id=Wireless
uuid=4ed139d4-14f5-4dc9-89cd-5604545c5fd6
type=802-11-wireless

[802-11-wireless]
ssid=Wireless
mode=infrastructure
mac-address=00:19:7E:81:F2:91
security=802-11-wireless-security

We would like to have ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-10-22 22:12:38 -0600

lavaman gravatar image

Neither Hiera nor Parameterized Classes, while both quite useful, actually answer the original question. The method by which data is populated in to formatted files in Puppet is via templates. They are embedded ruby syntax template files evaluated by puppet to insert data from several sources (facter/hiera/manifests).

See here for more info:

http://docs.puppetlabs.com/guides/templating.html

edit flag offensive delete link more

Comments

This is a good point. I made a most-likely false assumption that a template was already being used.

Ancillas gravatar imageAncillas ( 2013-10-23 09:54:37 -0600 )edit
2

answered 2013-10-22 14:46:41 -0600

Ancillas gravatar image

You could use Hiera and Parameterized Classes.

Simply put, your classes/modules will provide sane defaults for this file, and then you'll use Hiera to override those defaults.

In this case, you might use a client ID in your hiera hierarchy (that'll make more sense once you read up on hiera). When you're running your code on client A's server, their config options will be sourced from A.yaml, however when running on client B's server, their config would be pulled form B.yaml. In this way, you'd have only one piece of code ... (more)

edit flag offensive delete link more

Comments

Thanks, I'll take a look at Hiera and see what I can learn.

Idavis gravatar imageIdavis ( 2013-10-22 15:03:03 -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

Stats

Asked: 2013-10-22 13:08:26 -0600

Seen: 151 times

Last updated: Oct 22 '13