繁体   English   中英

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

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

我正在用file2(在代理计算机中)检查file1(在puppet master中)中的文件内容。 如果内容相同,则我将代理中master2的file1替换为file2。 如果内容不同,则什么都不做。 这样我就可以使用如下所示的文件资源:

      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 => "%", 
          } 
         }

但不会用相同的时间戳替换文件。 您能否提供使用相同时间戳替换文件的解决方案,以及如何检查我们的资源是否适用? 执行此命令后,我看到:

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

文档中看来,Puppet当前不会在代理端更新托管文件上的mtime 如果这对您很重要,请考虑打开功能请求

暂无
暂无

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

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