Puppet 将文件的内容与数组中的粒子名称连接起来

Puppet 将文件的内容与数组中的粒子名称连接起来,puppet,Puppet,我在目录中有许多名为file1.domain file2.domain file3.domain someanothername.domain的文件(在master上) 域始终是相同的 我需要定义的类型,我可以这样使用 mydefinedtype { "title": filenames => ["file1", "file2", "file3"], } 它将在节点上创建包含文件内容的文件 file1.domain file2.domain file3.domain我猜您

我在目录中有许多名为file1.domain file2.domain file3.domain someanothername.domain的文件(在master上) 域始终是相同的

我需要定义的类型,我可以这样使用

mydefinedtype { "title":
    filenames => ["file1", "file2", "file3"],
    }
它将在节点上创建包含文件内容的文件
file1.domain file2.domain file3.domain

我猜您的意思是希望在节点中部署一些文件

如果是这样的话,您可以做如下操作。这将把文件1、2、3从_模块/文件复制到目标目录:

$filenames = ["file1", "file2", "file3"]

define copy_file {
  file { "/targetdir/$name":
    source => 'puppet:///modules/your_module/$name',
  }
}

copy_file { $filenames }

请参阅:

您的意思是:将文件内容与数组中的名称连接起来?与数组中的粒子名称连接起来!或者至少是数组中的一组名称。