Vagrant Puppet-如何将目录的内容移动到另一个现有目录?
我有一个满是Vagrant Puppet-如何将目录的内容移动到另一个现有目录?,vagrant,puppet,Vagrant,Puppet,我有一个满是.data文件和.config/.config.example文件的目录。我需要使用puppet将所有.data文件移动到系统上的其他现有目录。我相信我目前的傀儡代码是不正确的——我做错了什么 file { 'Owasp .data files': ensure => directory, path => '/etc/nginx/', source => '/usr/src/SpiderLabs-owasp-modsecurity-crs-04
.data
文件和.config/.config.example
文件的目录。我需要使用puppet将所有.data
文件移动到系统上的其他现有目录。我相信我目前的傀儡代码是不正确的——我做错了什么
file { 'Owasp .data files':
ensure => directory,
path => '/etc/nginx/',
source => '/usr/src/SpiderLabs-owasp-modsecurity-crs-0475e92/',
recurse => true,
ignore => ['*.conf', '*.conf.example'],
}
我希望这会将.conf
和.conf.example
文件以外的所有文件复制到/etc/nginx
。但是,我得到以下错误:
框:错误:无法在/vagrant/modules/nginx_test/manifests/test中将文件[Owasp.data files]别名为[“/etc/nginx”]pp:112;资源[“File”,“/etc/nginx”]已在/usr/share/puppet/modules/nginx/manifests/config.pp:193声明
因此,您的问题实际上是在目录的其他地方声明了一个
文件{'/etc/nginx':}
。每个目录只需声明该资源一次。那会纠正你的错误。您也不能声明具有不同标题的两个文件资源,这两个文件资源都具有相同的路径
参数,因为Puppet会测试该参数的资源唯一性
但是,关于您的具体问题,您可以在源代码参数中使用文件URI:
因此,对于您的情况,您应该:
file { 'Owasp .data files':
ensure => directory,
path => '/etc/nginx/',
source => 'file:///usr/src/SpiderLabs-owasp-modsecurity-crs-0475e92/',
recurse => true,
ignore => ['*.conf', '*.conf.example'],
}
谢谢不幸的是,该文件资源位于我下载并正在使用的puppet forge模块中-不幸的是,我无法删除/编辑此文件。