Ask Your Question
0

puppet config management to ensure file content presence

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

geminiguy gravatar image

Hi,

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 :-

hostname="host123"

connectserver="test1.com,8080"

requesttimeout="60"

sharedsecret="{RC2}/ferDWCG5R"

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
0

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

geminiguy gravatar image

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

--geminiguy

edit flag offensive delete link more
0

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

GregLarkin gravatar image

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

You will find a bunch of information about different ways to manage files in Puppet here: https://doauto.wordpress.com/2013/06/22/how-to-change-a-file-using-puppet/

There are also several ways to get the data values into your managed file, including Hiera: http://docs.puppetlabs.com/hiera/1/

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

Stats

Asked: 2015-04-13 19:56:04 -0500

Seen: 144 times

Last updated: Apr 15 '15