Ask Your Question
0

Editing config files via puppet

asked 2013-09-01 22:48:53 -0500

mandm_zoom gravatar image

updated 2013-09-01 22:50:25 -0500

I have a need to edit the contents of 2 or more php files on multiple servers and add few lines to them .. I tried the following snippet, but could only edit 1 file at a time

file_line { 'info changes': ensure => present, match => "^ }

please let me know a better way to handle same changes to multiple files

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-09-02 00:19:33 -0500

nibalizer gravatar image

updated 2013-09-02 00:21:10 -0500

For a small set of files, you should probably simply have multiple file_line resources. If you are looking at many, many of these resources, you can use the create_resources function on a file_line resource to generate many resources.

File_line isn't exactly the puppet way. It is a nice tool for when we need it. But what you should be focusing on is putting your php config file into puppet and managing them with templates.

edit flag offensive delete link more

Comments

what about writing an augeas lens file for these kinds/your kind of php files. isnt that the prefered way to go?

Willi gravatar imageWilli ( 2013-09-02 15:59:37 -0500 )edit

Hi Will, yes i am trying to get augeas working on ubuntu agent server, but it isn't exactly easy to install...plus the packages are outdated

mandm_zoom gravatar imagemandm_zoom ( 2013-09-02 18:37:12 -0500 )edit

hi nibalizer yes i have to manage many php files on 1 server as each php file corresponds to separate db, i cannot have 1 files copied on all locations ...(more)

mandm_zoom gravatar imagemandm_zoom ( 2013-09-02 18:38:51 -0500 )edit

why not just use a template() function ?

golja gravatar imagegolja ( 2013-09-10 07:43:44 -0500 )edit

@golja I agree that template is the correct way to build configuration files. I got the impression from the question, reading between the lines a bit here, that the asker ...(more)

nibalizer gravatar imagenibalizer ( 2013-09-10 12:14:48 -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

1 follower

Stats

Asked: 2013-09-01 22:48:53 -0500

Seen: 350 times

Last updated: Sep 02 '13