Ask Your Question
0

how to replace a file with same time in puppet master to agent?

asked 2015-12-23 23:13:08 -0500

yoga gravatar image

updated 2015-12-28 12:30:47 -0500

GregLarkin gravatar image

I am checking the file content in file1(which is in puppet master) with file2(which is in agent machine). if the content are same mean i replace the file1 from master with file2 in agent. if the content are different mean do nothing.so that i am using the file resource like below,

class ysample::testing3{
  file{"/opt/ytesting/ymyfiles.txt":
      ensure=>"file",
      source=> "puppet://puppetmaster.solartis.net/ysample_home/ymyfiles.txt",
      source_permissions=>"use",
      recurse   => "true",
      show_diff => "true",
      validate_cmd =>"/opt/ytesting -t -f %",
      validate_replacement => "%",
             }
}

but it will not replace the file with same timestamp . give the solution to replace the file with same timestamp and how to check whether our resource are apply or not ? after i executing this command

-rw-r--r-- 1 root root 37 Dec 22 18:51 ymyfiles.txt  >>>(in master machine)
-rw-r--r-- 1 root root 37 Dec 22 18:19 ymyfiles.txt >>>(in agent machine)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-28 12:35:08 -0500

GregLarkin gravatar image

Are you asking whether you can replace a file on the master with a file on the agent? If so, the answer is no if you use a "file" resource. Puppet resources cause changes on the agent, and the file resource is used to manage a file on the agent, possibly using a source file on the master.

If I have misunderstood your question, can you clarify it a bit for me?

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-12-23 23:13:08 -0500

Seen: 256 times

Last updated: Dec 28 '15