Yaml Puppet hiera未正确继承(Puppet版本4.3.2)
我的Yaml Puppet hiera未正确继承(Puppet版本4.3.2),yaml,puppet,hierarchy,hiera,facter,Yaml,Puppet,Hierarchy,Hiera,Facter,我的/etc/puppetlabs/code文件夹结构: [vagrant@client code]$ pwd /etc/puppetlabs/code [vagrant@client code]$ tree . ├── environments │ ├── production │ │ ├── environment.conf │ │ ├── hieradata │ │ ├── manifests │ │ └── modules │ └── test │
/etc/puppetlabs/code
文件夹结构:
[vagrant@client code]$ pwd
/etc/puppetlabs/code
[vagrant@client code]$ tree
.
├── environments
│ ├── production
│ │ ├── environment.conf
│ │ ├── hieradata
│ │ ├── manifests
│ │ └── modules
│ └── test
│ ├── hieradata
│ ├── manifests
│ │ └── site.pp
│ └── modules
├── hieradata
│ ├── common.yaml
│ └── hostname
│ └── client.yaml
├── hiera.yaml
└── modules
然后,对于我的YAML文件:
[vagrant@client code]$ cat hiera.yaml
---
:backends:
- yaml
:hierarchy:
- "hostname/%{facts.hostname}"
- "os/%{facts.osfamily}"
- common
:yaml:
:datadir: /etc/puppetlabs/code/hieradata
merge_behavior: deeper
[vagrant@client code]$ cat hieradata/common.yaml
---
users:
jill:
uid: 1000
home: '/home/jill'
jack:
uid: 1001
home: '/home/jack'
[vagrant@client code]$ cat hieradata/hostname/client.yaml
---
users:
jill:
home: '/homes/jill'
jack:
home: '/homes/jack'
jane:
uid : 999
home: '/homes/jane'
然而,当我运行hiera时,我得到以下信息:
[vagrant@client code]$ hiera --hash users
{"jill"=>{"uid"=>1000, "home"=>"/home/jill"},
"jack"=>{"uid"=>1001, "home"=>"/home/jack"}}
[vagrant@client code]$ hiera --hash users ::hostname=client
{"jill"=>{"uid"=>1000, "home"=>"/home/jill"},
"jack"=>{"uid"=>1001, "home"=>"/home/jack"}}
Myhieradata/hostname/client.yaml
应该覆盖common.yaml
,导致hiera
命令在提交::hostname=client
时返回不同的内容
我做错了什么?$facts散列是由puppet代理/apply设置的,当您尝试通过hiera命令行验证设置时,我不希望它可用
您可以在您的层次结构中使用<代码> -“主机名/%{::HoestNe}}”/Cuth>以获得您的HIERA CMD的预期结果,或者考虑使用木偶命令行来验证您的设置。 HMM,这部分工作,但不完全。它在HIRIT中有,但例如,
uid=1000
不会传播到“客户机”[vagrant@client代码]$hiera--hash users::hostname=client{“jill”=>{“home”=>“/homes/jill”},“jack”=>{“home”=>“/homes/jack”},“jane”=>{“uid”=>999,“home”=>“/homes/jane”}[vagrant@client代码]$hiera——散列用户{“jill”=>{“uid”=>1000,“home”=>“/home/jill”},“jack”=>{“uid”=>1001,“home”=>“/home/jack”}}
啊,是的!在合并行为之前缺少冒号。应该是:合并行为:更深层