Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Puppet 通过通配符/或正则表达式查找Hiera_Puppet_Hiera - Fatal编程技术网

Puppet 通过通配符/或正则表达式查找Hiera

Puppet 通过通配符/或正则表达式查找Hiera,puppet,hiera,Puppet,Hiera,我有一个关于puppet/hiera的问题,但在此之前,我想介绍一下我们的基础设施。目前,我们有一些文件/注册表资源,用于管理azure虚拟机上的注册表或文件系统。在资源组中,我们可能有一个或多个虚拟机。资源组中虚拟机的命名约定遵循DCC-123456-01A、.-02A等。在hiera中,我们的信息如下所示 - name: "Root file system Customer Specific" path: "customer/%{trusted.certname}/file_sys

我有一个关于puppet/hiera的问题,但在此之前,我想介绍一下我们的基础设施。目前,我们有一些文件/注册表资源,用于管理azure虚拟机上的注册表或文件系统。在资源组中,我们可能有一个或多个虚拟机。资源组中虚拟机的命名约定遵循DCC-123456-01A、.-02A等。在hiera中,我们的信息如下所示

- name:  "Root file system Customer Specific"
    path: "customer/%{trusted.certname}/file_system.json"

  - name: "hotfixes customer specific"
    path: "customer/%{trusted.certname}/hotfixes.json"

  - name: "Customer Specific Registry Keys"
    path: "customer/%{trusted.certname}/registry.json"


正如您所看到的,我们已经创建了特定于客户的.json文件。我不想为资源组中的每个虚拟机创建多个文件夹,就像我在特定于客户的文件夹中为我的两个创建多个文件夹一样,如果我可以在hiera中使用通配符或正则表达式,并且只创建一个条目。

hiera支持globs作为文件路径。它们记录在

有了一个地球仪,你应该可以做如下事情

- name: "customer specific files"
  glob: "customer/%{trusted.certname}/*.json"

使用glob可能会遇到的一个问题是,您无法控制覆盖。例如,如果您有
a.json
b.json
,则很可能会根据它们的负载(不保证按字母顺序)被覆盖。因此,如果您在两个hieradata中都有数据
x:y1
x:y2
,您可以使用
查找
来确定加载顺序,但在主要升级(或其他情况)后,无法保证hiera文件的加载顺序。