我的/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"}}
我hieradata/hostname/client.yaml
应该覆盖common.yaml
,导致hiera
命令在提交时返回不同的东西::hostname=client
。
我究竟做错了什么?