Ask Your Question
0

How to change the contents of file when this file is already present?

asked 2015-03-18 05:56:35 -0600

akshay gravatar image

I want to change the contents of file when this file is already present on agent machine For e.g. Suppose this is the file as demo.txt The contents of demo.txt is, Welcome, Hello world I m working in company I want to replace the "I m working in company" as 'Bye Bye' So how to write code for that in manifest? What code I should written in my puppet manifests? Please help me for that. Please give me answer because I m doing a lots of searching on that thing. So please help me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-21 03:33:59 -0600

doc75 gravatar image

Hello,

If this is a file you need to modify from time to time, you should use a template. Otherwise you need to execute a script directly from puppet who will do the job with something like sed or perl.

Hope this helps.

edit flag offensive delete link more

Comments

But how to add this? How to write the template.? Please tell me any demo code which should written in sed or perl or ruby lang.

akshay gravatar imageakshay ( 2015-03-31 00:48:36 -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: 2015-03-18 05:56:35 -0600

Seen: 450 times

Last updated: Mar 21 '15