我使用foreman-installer安装了Puppet,并且安装成功。
然后,我想安装Hiera因为我有一些使用hierafunction的模块,所以我安装了hiera,并在/etc/puppet创build了一个相关的hiera.yaml文件,如下所示:
:backends: - yaml :yaml: :datadir: '/etc/puppet/hieradata/%{::environment}' :hierarchy: - fqdns/%{::fqdn} - roles/%{::role} - domains/%{::domain} - common
另外,我创build了一个从/etc/puppet/hiera.yaml到/etc/hiera.yaml的符号链接。
我也创build了所需的文件夹来支持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并在这里find它:
/usr/lib/ruby/gems/1.8/gems/hiera-puppet-1.0.0/lib/puppet/parser/functions/hiera_include.rb
这似乎是function的正确path。
Puppet的site.pp看起来像这样:
[root@dev5-puppet01 puppet]# cat /etc/puppet/manifests/site.pp # Empty site.pp required (puppet #15106, foreman #1708) hiera_include('classes'
)
一些相关的信息:木偶版本:2.7.26插件同步在Puppet服务器上启用,它也是自己的客户端。
那么我做错了什么? Puppet找不到这个function?
有可能您需要手动将函数rb文件复制到/usr/lib/ruby/gems/1.8/gems/puppet-${version}/lib/puppet/parser/functions/但我强烈build议不再在生产环境中运行Puppet 2.7.x(开源)。
这是生命的结束,不会再得到更新,请参阅:
http://docs.puppetlabs.com/release_notes/
目前支持的(开源)版本是3.8和4.2。