puppet自动化部署的FAQ

之前发布的“运维自动化之svn+puppet实现监控系统的版本控制与自动部署监控系统,http://dl528888.blog.51cto.com/2382721/1040552 ”,由于文章篇幅比较大,所以faq部分就做为单独的一篇文章发布,如果大家有任何的问题,可以再下面留言,我会及时的帮您解决。

FAQ

1、如果在客户端发起证书请求的时候,出现以下问题
 
 
  1. [root@slave ~]# puppetd --server master --test  
  2. err: Could not retrieve catalog from remote server: certificate verify failed.  This is often because the time is out of sync on the server or client  
  3. warning: Not using cache on failed catalog  
  4. err: Could not retrieve catalog; skipping run  
  5. err: Could not send report: certificate verify failed.  This is often because the time is out of sync on the server or client  

原因是服务端与客户端的时间不一致,解决方法是调整相同的时间,可以使用ntpdate 210.72.145.44或者cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

修改时区后,如果在客户端里发起证书请求的时候,还出现以下问题

 
 
  1. [root@slave ~]# puppetd --server cobbler --test  
  2. err: Could not retrieve catalog from remote server: certificate verify failed.  This is often because the time is out of sync on the server or client  
  3. warning: Not using cache on failed catalog  
  4. err: Could not retrieve catalog; skipping run  
  5. err: Could not send report: certificate verify failed.  This is often because the time is out of sync on the server or client  

那么你可以查看你的iptables是否关闭,如果没有关闭先关闭他,如果已经关闭,那么重启服务器端与客户端的puppetmaseter与puppet就可以,然后再进行证书请求

 
 
  1. [root@slave ~]# /etc/init.d/puppet restart  
  2. Stopping puppet:                                           [  OK  ]  
  3. Starting puppet:                                           [  OK  ]  
  4. [root@slave ~]# puppetd --server master --test  
  5. warning: peer certificate won't be verified in this SSL session  
  6. warning: peer certificate won't be verified in this SSL session  
  7. info: Creating a new SSL certificate request for slave  
  8. info: Certificate Request fingerprint (md5): 3F:9D:52:1E:B2:11:01:90:5F:0F:19:CB:5F:6F:22:E1  
  9. warning: peer certificate won't be verified in this SSL session  
  10. warning: peer certificate won't be verified in this SSL session  
  11. warning: peer certificate won't be verified in this SSL session  
  12. Exiting; no certificate found and waitforcert is disabled  

可以看到已经成功。

然后再服务端里查看

 
 
  1. [root@master ~]# puppetca --list  
  2.   slave (3F:9D:52:1E:B2:11:01:90:5F:0F:19:CB:5F:6F:22:E1)  
  3. 也收到了客户端的证书请求  
  4. [root@master ~]# puppetca -s slave  
  5. notice: Signed certificate request for slave  
  6. notice: Removing file Puppet::SSL::CertificateRequest slave at '/var/lib/puppet/ssl/ca/requests/slave.pem'  

在对请求进行签名

2、如果在客户端发起证书请求的时候,出现以下问题

 
 
  1. [root@slave ~]# puppetd --server master --test  
  2. notice: Run of Puppet configuration client already in progress; skipping  

原因可能是site.pp没有配置或者puppet需要把/var/lib/puppet/state/里的puppetdlock给删除。

3、如果出现以下主机名不匹配问题

 
 
  1. [root@web-server ~]# puppetd --server beiyong --test  
  2. warning: peer certificate won't be verified in this SSL session  
  3. info: Caching certificate for web-server  
  4. err: Could not retrieve catalog from remote server: hostname not match with the server certificate  
  5. warning: Not using cache on failed catalog  
  6. err: Could not retrieve catalog; skipping run  
  7. err: Could not send report: hostname not match with the server certificate  

可能你的/etc/hosts 下/etc/sysconfig/network 下都没有问题,
但 cat /etc/resolv.conf
看看
search localdomain
有没有被注释掉
产生证书的过程是搜索域,如果没有完整的话,会默认的在主机后面加上 hostname.localdomain
客户端拿到证书后,再去跟主机名匹配后,发现不一致了。
解决方法:
(1)、 对/etc/resolv.conf里的search localdomain注释
(2)、或者用完整主机名(带 . 的 )

4、如果在puppet客户端发起请求的时候,如果速度很慢,甚至出现

 
 
  1. err: Could not run Puppet configuration client: execution expired 

那么可能的问题就是puppet服务器与客户端的时间不一致,解决方法是

运行ntpdate 210.72.145.44 (210.72.145.44是中国国家授时中心的官方服务器)

如果运行出现

 
 
  1. [root@eng shell]# ntpdate 210.72.145.44   
  2. 13 Oct 17:16:14 ntpdate[18633]: no server suitable for synchronization found  

那么可以使用ntpdate us.pool.ntp.org,基本就能解决此问题,当然你想使用ntpdate更新时间的话,一定要能与外网连接,dns设置正确。

5、如果在puppet客户端启动puppet的时候,出现以下错误

 
 
  1. [root@web-server ~]# /etc/init.d/puppet start  
  2. Starting puppet: dnsdomainname: Unknown host  
  3.                                                            [  OK  ]  

代表本机的/etc/hosts里没有本机的ip对应主机

6、如果在服务器需要给客户端证书许可的时候,出现以下情况

 
 
  1. [root@beiyong ~]# puppetca --list  
  2.   cunchu.localdomain     (E8:28:0A:83:08:A6:E5:AA:E6:4E:AB:09:72:FA:EA:7D)  
  3.   jiaohuan.localdomain   (5B:B9:64:8A:76:25:7B:F1:BD:C1:A4:98:96:A7:FB:A6)  
  4.   web-server.localdomain (09:EE:28:3C:A4:52:99:E5:05:FF:DC:CC:BF:45:59:21)  

客户端带有.localdomain字样的,是因为/etc/resolv.conf里有search localdomain,只有把这个删除即可解决此问题,但需要把现在的证书都给删除,可以使用puppetca -c hostname来进行

 
 
  1. [root@beiyong ~]# puppetca -c all  
  2. err: Could not call revoke: Could not find a serial number for all  
  3. [root@beiyong ~]# puppetca -c cunchu.localdomain   
  4. err: Could not call revoke: Could not find a serial number for cunchu.localdomain  
  5. notice: Removing file Puppet::SSL::CertificateRequest cunchu.localdomain at '/var/lib/puppet/ssl/ca/requests/cunchu.localdomain.pem'  
  6. [root@beiyong ~]# puppetca -c jiaohuan.localdomain  
  7. err: Could not call revoke: Could not find a serial number for jiaohuan.localdomain  
  8. notice: Removing file Puppet::SSL::CertificateRequest jiaohuan.localdomain at '/var/lib/puppet/ssl/ca/requests/jiaohuan.localdomain.pem'  
  9. [root@beiyong ~]# puppetca -c web-server.localdomain  
  10. err: Could not call revoke: Could not find a serial number for web-server.localdomain  
  11. notice: Removing file Puppet::SSL::CertificateRequest web-server.localdomain at '/var/lib/puppet/ssl/ca/requests/web-server.localdomain.pem'  

然后再在客户端里进行证书申请,就可以再服务器看见  

 
 
  1. [root@beiyong ~]# puppetca --list  
  2.   cunchu     (37:26:10:E5:5C:C7:2E:45:63:2C:76:1D:93:DF:B3:1F)  
  3.   jiaohuan   (46:FD:7D:95:23:E2:9C:32:26:A7:E7:C0:76:E9:58:6A)  
  4.   web-server (EE:75:B5:9B:5C:4F:51:6F:9B:E4:98:46:C6:C2:D7:5E)  

7、一般在/var/log/message里出现以下情况

 
 
  1. Oct 27 14:41:45 web-server puppet-agent[14722]: Using cached catalog  
  2. Oct 27 14:41:45 web-server puppet-agent[14722]: Could not retrieve catalog; skipping run  
  3. Oct 27 14:41:51 web-server puppet-agent[14722]: Could not send report: getaddrinfo: Name or service not known  
  4. Oct 27 14:42:52 web-server puppet-agent[14722]: Could not retrieve catalog from remote server: getaddrinfo: Name or service not known  

是由于你的puppet的server没有修改,还是默认的puppet

你需要在/etc/sysconfig/puppet里的

 
 
  1. # The puppetmaster server  
  2. PUPPET_SERVER=puppet 

把PUPPET_SERVER=puppet里的puppet改成你服务端的hostname

然后重启puppet服务,之后message就会把报错了,之后的内容就是

 
 
  1. Oct 27 14:44:30 web-server puppet-agent[22232]: Finished catalog run in 0.21 seconds  
  2. Oct 27 14:45:31 web-server puppet-agent[22232]: Finished catalog run in 0.23 seconds  
  3. Oct 27 14:46:33 web-server puppet-agent[22232]: Finished catalog run in 0.19 seconds  
  4. Oct 27 14:47:34 web-server puppet-agent[22232]: Finished catalog run in 0.19 seconds  
  5. Oct 27 14:48:35 web-server puppet-agent[22232]: Finished catalog run in 0.23 seconds  
  6. Oct 27 14:49:37 web-server puppet-agent[22232]: Finished catalog run in 0.19 seconds  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值