puppet hiera无法读取yaml文件

puppet hiera无法读取yaml文件,puppet,hiera,Puppet,Hiera,我对puppet相当陌生。我配置了一个hiera文件,其路径是/etc/puppetlabs/puppet/hiera.yaml,同样 version: 5 hierarchy: [] backends: - yaml yaml: - datadir: /etc/puppetlabs/puppet/some_dir 我得到了这个错误 Warning: The function 'hiera' is deprecated in favor of using 'lookup'. S

我对
puppet
相当陌生。我配置了一个
hiera
文件,其路径是
/etc/puppetlabs/puppet/hiera.yaml
,同样

version: 5

hierarchy: []

backends:
  - yaml

yaml:
  - datadir: /etc/puppetlabs/puppet/some_dir
我得到了这个错误

 Warning: The function 'hiera' is deprecated in favor of using 'lookup'. See https://docs.puppet.com/puppet/5.3/reference/deprecated_language.html
       (file & line not available)
    Error: Evaluation Error: Error while evaluating a Function Call, Lookup of key 'user_dir' failed:  The Lookup Configuration at '/etc/puppetlabs/puppet/hiera.yaml' has wrong type, unrecognized key 'backends'
      The Lookup Configuration at '/etc/puppetlabs/puppet/hiera.yaml' has wrong type, unrecognized key 'yaml' at /etc/puppetlabs/code/environments/production/manifests/site.pp:30:17 on node puppet,some_cluster_DNS.internal
最初,我对键
:backends:
:yaml:
有这样的格式,但对于
5
版本来说,它似乎不是常规格式,所以我删除了
符号


有人有主意了吗?

首先,就警告而言,如果您使用的是Hiera>=4:

其次,关于该错误,我将查阅有关如何设置Hiera 5配置文件的文档:

使用正确的格式,您的配置文件如下所示:

# /etc/puppetlabs/puppet/hiera.yaml
version: 5

defaults:
  - data_hash: yaml_data
  - datadir: /etc/puppetlabs/puppet/some_dir

hierarchy: []
Hiera 5中不允许您在最后一行尝试执行的操作(为
yaml_数据
后端指定特定的
datadir
)。如果要为特定后端指定
datadir
,则需要仅为该后端指定层次结构的级别(或仅为该后端的datadir;您可以使用它在多个深度的矩阵中进行自定义),并在那里指定
datadir
。例如:

hierarchy:
  - name: yaml data
    data_hash: yaml_data
    datadir: /etc/puppetlabs/puppet/some_dir
    paths:
      - "%{trusted.certname}.yaml"
      - common.yaml