简体   繁体   English

如何在p代理中同时替换文件到代理?

[英]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). 我正在用file2(在代理计算机中)检查file1(在puppet master中)中的文件内容。 If the contents are the same mean I replace the file1 from master with file2 in agent. 如果内容相同,则我将代理中master2的file1替换为file2。 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. 文档中看来,Puppet当前不会在代理端更新托管文件上的mtime If this is important to you, please consider opening a feature request . 如果这对您很重要,请考虑打开功能请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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