我已经使用安装了 Puppet,foreman-installer
并且它安装成功。
然后,我想安装,Hiera
因为我有一些使用 hiera 功能的模块,所以我安装了 hiera 并创建了一个相关hiera.yaml
文件,/etc/puppet
如下所示:
:backends:
- yaml
:yaml:
:datadir: '/etc/puppet/hieradata/%{::environment}'
:hierarchy:
- fqdns/%{::fqdn}
- roles/%{::role}
- domains/%{::domain}
- common
此外,我还创建了一个从/etc/puppet/hiera.yaml
到 的符号链接/etc/hiera.yaml
。
我还创建了支持 hiera 层次结构所需的文件夹。
以下是服务器上安装的 gem 包的列表:
ansi (1.4.3)
clamp (0.6.2)
facter (2.4.4)
ffi (1.0.9)
foreman_api (0.1.11)
gssapi (1.1.2)
hashie (2.0.5)
hiera (3.0.1, 1.3.4)
hiera-puppet (1.0.0)
highline (1.6.21)
json (1.4.6)
json_pure (1.8.2)
kafo (0.5.4)
kafo_parsers (0.0.2)
little-plugger (1.1.3)
logging (1.8.1)
mime-types (1.16)
multi_json (1.8.2)
netrc (0.7.7)
oauth (0.4.7)
passenger (4.0.18)
powerbar (1.0.11)
rack (1.1.0)
rack-test (0.5.4)
rake (0.8.7)
rdoc (3.12)
rest-client (1.6.7)
rkerberos (0.1.2)
rubyipmi (0.7.0)
sinatra (1.0)
hiera 作为命令在服务器中工作:
[root@dev5-puppet01 puppet]# hiera role
nil
但是当我运行:时puppet agent -t
,出现以下错误:
[root@dev5-puppet01 puppet]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Unknown function hiera_include at /etc/puppet/manifests/site.pp:2 on node dev5-puppet01.domain.com
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
我跑过去locate hiera_include
发现它在这里:
/usr/lib/ruby/gems/1.8/gems/hiera-puppet-1.0.0/lib/puppet/parser/functions/hiera_include.rb
这似乎是该功能的正确路径。
Puppet 的site.pp
样子如下:
[root@dev5-puppet01 puppet]# cat /etc/puppet/manifests/site.pp
# Empty site.pp required (puppet #15106, foreman #1708)
hiera_include('classes'
)
一些相关信息:Puppet 版本:2.7.26 Pluginsync 在 Puppet 服务器上启用,该服务器也充当它自己的客户端。
那么我做错了什么?为什么 Puppet 找不到该函数?
答案1
您可能需要手动将函数 rb 文件复制到,/usr/lib/ruby/gems/1.8/gems/puppet-${version}/lib/puppet/parser/functions/
但我强烈建议不要再在生产环境中运行 Puppet 2.7.x(开源)。
它已停产,不会再获得更新,请参阅:
http://docs.puppetlabs.com/release_notes/
当前支持的(开源)版本是 3.8 和 4.2。