|
puppet错误解决--Could not evaluate: Could not retrieve information from environment production source
故障现象:
[iyunv@linux57poc ~]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/fact_apply.rb
info: Caching catalog for puppet_linux57poc.gov.shanghaigm.com
info: Applying configuration version '1385819456'
err: /Stage[main]/Puppet_linux57poc::Test/File[/tmp/test.txt]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/puppet_linux57poc/etc/test.txt at /etc/puppet/environments/production/agents/modules/puppet_linux57poc/manifests/init.pp:25
notice: /Stage[main]/Mcollective::Facter/File[/etc/mcollective/facts.yaml]/content:
--- /etc/mcollective/facts.yaml 2013-11-30 21:50:18.000000000 +0800
+++ /tmp/puppet-file20131130-3983-m8yrvi-0 2013-11-30 21:50:58.000000000 +0800
解决方法:
这个问题一般出现在puppetmaster上,有两种可能,一种是fileserver端文件不存在,一种是source路径写的不正确,正确写入如下 文件目录列表:
[iyunv@linuxmaster1poc modules]# tree puppet_linux57poc/
puppet_linux57poc/
├── files
│ └── etc
│ └── test.txt
├── manifests
│ └── init.pp
└── templates
├── facts.txt.erb
└── motd.erb
4 directories, 4 files
pp文件内容:
[iyunv@linuxmaster1poc modules]# cat puppet_linux57poc/manifests/init.pp
class puppet_linux57poc{
include puppet_linux57poc::motd,puppet_linux57poc::facts,puppet_linux57poc::test
}
class puppet_linux57poc::motd{
package{ setup:
ensure => present,
}
file{ "/etc/motd":
owner => "root",
group => "root",
mode => 0400,
content => template("puppet_linux57poc/motd.erb"),
backup => 'main',
require => Package["setup"],
}
}
class puppet_linux57poc::test{
file{ "/tmp/test.txt":
owner => "root",
group => "root",
mode => 0400,
source => "puppet:///modules/puppet_linux57poc/etc/test.txt", #正确写法
backup => 'main',
}
}
class puppet_linux57poc::facts{
file{ "/etc/mcollective/facts.txt":
owner => "root",
group => "root",
mode => 0400,
content => template("puppet_linux57poc/facts.txt.erb"),
backup => 'main',
}
}
测试:
[iyunv@linux57poc ~]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/fact_apply.rb
info: Caching catalog for puppet_linux57poc.gov.shanghaigm.com
info: Applying configuration version '1385819456'
notice: /Stage[main]/Puppet_linux57poc::Test/File[/tmp/test.txt]/ensure: defined content as '{md5}18dc28902480f14de4c115d5e5601de8'
notice: /Stage[main]/Mcollective::Facter/File[/etc/mcollective/facts.yaml]/content:
--- /etc/mcollective/facts.yaml 2013-11-30 21:50:58.000000000 +0800
+++ /tmp/puppet-file20131130-4340-rjtmkk-0 2013-11-30 21:58:54.000000000 +0800
@@ -7,15 +7,15 @@
facterversion: "1.7.3"
netmask: "255.255.255.0"
puppetversion: "2.7.23"
- environment: production
|
|