假设我有一个带有的模块files/etc/foo/{conf0, conf1, conf2, conf3, etc}
。当文件数量较少时,放置每个文件都很简单:
file { 'conf0':
path => '/etc/foo/conf0',
ensure => true,
source => 'puppet:///.../etc/foo/conf0',
}
并重复。但这会涉及相当多的重复,如果有多个配置文件,维护起来会很繁琐。我想确保将其files/etc/foo/
镜像到给定路径。也就是说,
file { 'etc foo confs':
path => '/etc/foo',
ensure => recursive,
source => 'puppet:///.../etc/foo',
}
将创建/etc/foo/conf0
,/etc/foo/conf1
等等。这可能吗?
答案1
当然 - 该files
类型有一个recurse
选项(recurselimit
如果您想限制它进入目录的深度)。
file { 'etc foo confs':
path => '/etc/foo',
source => 'puppet:///.../etc/foo',
recurse => true,
}