我想将我的节点配置存储在 .eyaml 文件中。
"hieradata/node/client.puppetmaster.local.eyaml"
---
ntp::restrict:
-
ntp::autoupdate: false
ntp::enable: true
ntp::servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
- 2.pool.ntp.org
- 3.pool.ntp.org
但是当我尝试读取参数时
hiera ntp::servers ::fqdn=puppet.puppetmaster.local
我收到此错误消息
/var/lib/gems/1.9.1/gems/hiera-eyaml-2.0.7/lib/hiera/backend/eyaml_backend.rb:39:in `block in lookup': undefined method `empty?' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:76:in `block in datasources'
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:74:in `map'
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:74:in `datasources'
from /var/lib/gems/1.9.1/gems/hiera-eyaml-2.0.7/lib/hiera/backend/eyaml_backend.rb:29:in `lookup'
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:206:in `block in lookup'
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:203:in `each'
from /usr/lib/ruby/vendor_ruby/hiera/backend.rb:203:in `lookup'
from /usr/lib/ruby/vendor_ruby/hiera.rb:60:in `lookup'
from /usr/bin/hiera:225:in `<main>'
当我将配置存储在 .yaml 文件中时,它工作正常。
我希望你能帮助我=)
~编辑 hiera.yaml
---
:merge_behavior: deeper
:backends:
- yaml
- eyaml
:logger: console
:yaml:
:datadir: '/etc/puppet/hieradata'
:extension: 'yaml'
:eyaml:
:datadir: '/etc/puppet/hieradata'
:pkcs7_private_key: '/etc/puppet/keys/private_key.pkcs7.pem'
:pkcs7_public_key: '/etc/puppet/keys/public_key.pkcs7.pem'
:extension: 'eyaml'
:hierarchy:
- "node/%{::fqdn}"
- node/common
- fqdn/%{fqdn}
- env/%{environment}/%{fqdn}
- osfamily/%{osfamily}
- lsbdistcodename/%{lsbdistcodename}
- common
我必须创建一个符号链接
/etc/puppet/hiera.yaml -> /etc/hiera.yaml