简体   繁体   中英

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

I am checking the file content in file1 (which is in puppet master) with file2 (which is in agent machine). If the contents are the same mean I replace the file1 from master with file2 in agent. If the content are a 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/ysamplehome/ymyfiles.txt",
      sourcepermissions=>"use", 
      recurse => "true", 
      showdiff => "true", 
      validatecmd =>"/opt/ytesting -t -f %", 
      validate_replacement => "%", 
          } 
         }

but it will not replace the file with same timestamp. Can you give the solution to replace the file with same timestamp and how to check whether our resource are apply or not? After I executed this command I see:

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

From the documentation it does not appear that Puppet will currently update the mtime on managed files on the agent side. If this is important to you, please consider opening a feature request .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM