Ask Your Question

puppet config management to ensure file content presence

asked 2015-04-13 19:56:04 -0600

geminiguy gravatar image


Is it possible to declare in Puppet ,to ensure specific field values inside a file ? The catch is the particular file in each host has some unique field value( generated per node) plus at the same time some constant field values.

Example File content :-





Here the hostname and sharedsecret values are unique to each node( generated per node). But connectserver and requesttimeout are constant values across all hosts.

Is there a way to declare in Puppet to ensure the constant values remain same across all nodes and at the same time Puppet should skip the unique content values inside the file ? My intention is if someone manually modifies the hostname or connectserver field values in the file on any hosts, Puppet should change it back to desired value.

Thanks, Geminiguy

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-04-14 11:50:02 -0600

geminiguy gravatar image

Thanks a lot Greg, Let me check and try that out.


edit flag offensive delete link more

answered 2015-04-13 23:56:27 -0600

GregLarkin gravatar image

updated 2015-04-15 00:19:30 -0600

You will find a bunch of information about different ways to manage files in Puppet here:

There are also several ways to get the data values into your managed file, including Hiera:

It sounds like you only want to manage portions of the file, and depending on your config file structure, you'll probably either use the file_line resource or the augeas resource to do that.

Hope that helps!

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: 2015-04-13 19:56:04 -0600

Seen: 177 times

Last updated: Apr 15 '15