1

我是 Puppet 和 Hiera 的新手,在尝试将包含 Hiera 查找的模块应用到代理时遇到配置问题。

来自 /etc/puppetlabs/puppet/hiera.yaml:

---
:backends:
  - yaml
:hierarchy:
  - defaults
  - "%{clientcert}"
  - "%{environment}"
  - global

:yaml:
  :datadir: '/etc/puppetlabs/puppet/hiera'

来自 /etc/puppetlabs/puppet/hiera/develop.yaml:

git_client:
    file_content:here

运行 Hiera 进行调试时:

/opt/puppet/bin/hiera git_client environment=develop -c /etc/puppetlabs/puppet/hiera.yaml --debug

DEBUG: 2015-05-12 12:40:27 -0400: Hiera YAML backend starting
DEBUG: 2015-05-12 12:40:27 -0400: Looking up git_client in YAML backend
DEBUG: 2015-05-12 12:40:27 -0400: Looking for data source defaults
DEBUG: 2015-05-12 12:40:27 -0400: Cannot find datafile /etc/puppetlabs/puppet/hiera/defaults.yaml, skipping
DEBUG: 2015-05-12 12:40:27 -0400: Looking for data source develop
DEBUG: 2015-05-12 12:40:27 -0400: Found git_client in develop
file_content:here

puppet.conf 中的 Windows 代理配置:

[main]
server=[REDACTED]
pluginsync=true
autoflush=true
archive_files=true
archive_file_server=[REDACTED]
graph=true
environment=develop

但是从 Windows 代理运行时:

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item git_client in any Hiera data file and no default supplied at /etc/puppetlabs/puppet/environments/develop/modules/[REDACTED PATH TO .pp FILE]:24 on node [REDACTED]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

我一定有一些错误配置,但我不确定在哪里。任何帮助,将不胜感激。

4

1 回答 1

1

为了使您的hiera配置更改生效,您需要确保重新启动您的puppet master. 如果您使用的puppetserver是运行在JVM然后重新启动pe-puppetserver服务。如果你正在使用旧的rubymaster上运行passenger,那么重新启动pe-httpd

取自hiera 文档

Puppet master 注意:如果您在代理运行之间修改 hiera.yaml,则必须重新启动您的 puppet master 才能使更改生效。

于 2015-05-13T14:11:38.970 回答