chkconfig puppet on
chkconfig puppetmaster on
service puppetmaster start
service puppet start
Puppet Master 运行在TCP的8140端口。以前iptables的命令打开一个端口很长,很难记忆,现在发现一个好工具 lokkit。打开的端口,重启机器也是不影响,非常方便。
chkconfig puppet on
service puppet start
puppet的基本默认配置,这里面的内容是不需要修改。
# cat /etc/sysconfig/puppet
# The puppetmaster server
#PUPPET_SERVER=puppet
# If you wish to specify the port to connect to do so here
#PUPPET_PORT=8140
# Where to log to. Specify syslog to send log messages to the system log.
#PUPPET_LOG=/var/log/puppet/puppet.log
# You may specify other parameters to the puppet client here
#PUPPET_EXTRA_OPTS=--waitforcert=500
上面就是Puppet的默认设置,大家可以去掉注释,进行修改。这也是为啥puppet的agent,默认就到网络找一个puppet的机器,你可以在这里修改。
/var/lib/puppet 目录,是客户端一个比较重要的目录,agent的证书就是放在这个目录下。
]# pwd
/var/lib/puppet
]# ll
total 24
drwxr-x--- 2 root root 4096 Oct 26 15:35 clientbucket
drwxr-x--- 2 root root 4096 Oct 26 15:35 client_data
drwxr-x--- 2 root root 4096 Oct 26 15:35 client_yaml
drwxr-xr-x 2 root root 4096 Oct 26 15:35 lib
drwxrwx--x 7 puppet root 4096 Oct 26 15:35 ssl
drwxr-xr-t 3 root root 4096 Oct 26 15:35 state
Puppet agent 配置文件,是 /etc/puppet/puppet.conf , 基本编辑这个文件可以。
[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig
server = node06.chenshake.com
重启agent就可以,这个时候,你就不需要加上服务器地址,就可以连接master。
Debug: Finishing transaction 70232051730000
Error: Could not request certificate: No route to host - connect(2)
Exiting; failed to retrieve certificate and waitforcert is disabled
如果一切正常,你回看到下面输出
Debug: Finishing transaction 69982568075580
Info: Caching certificate for ca
Info: Creating a new SSL certificate request for node08.chenshake.com
Info: Certificate Request fingerprint (SHA256): DC:BF:4A:B7:65:9F:8D:80:79:42:B3:1D:94:B6:D9:
A7:1B:99:38:EB:49:DA:13:1E:E2:CE:56:5C:78:CC:12:53
Debug: Using cached certificate for ca
Debug: Using cached certificate for ca
Exiting; no certificate found and waitforcert is disabled
这个时候,你在服务器端就可以看到请求签发的证书
Debug: Using cached certificate_revocation_list for ca
Error: Failed to apply catalog: SSL_connect returned=1
errno=0 state=SSLv3 read server session ticket A: sslv3 alert certificate revoked
Debug: Value of 'preferred_serialization_format' (pson)
is invalid for report, using default (b64_zlib_yaml)
Debug: report supports formats: b64_zlib_yaml raw yaml; using b64_zlib_yaml
Error: Could not send report: SSL_connect returned=1
errno=0 state=SSLv3 read server session ticket A: sslv3 alert certificate revoked 删除证书
在master上,清除证书后,需要重启服务才能生效.
# puppet cert --clean node08.chenshake.com
Revoked certificate with serial 3
Removing file Puppet::SSL::Certificate node08.chenshake.com at '/var/lib/puppet/ssl/ca/signed/node08.chenshake.com.pem'
Removing file Puppet::SSL::Certificate node08.chenshake.com at '/var/lib/puppet/ssl/certs/node08.chenshake.com.pem'
重启puppetmaster服务,
# puppet agent -t
Info: Creating a new SSL certificate request for node08.chenshake.com
Info: Certificate Request fingerprint (SHA256): 43:4F:C8:D7:B0:84:D8:89:F6:D9:9C:DE:D4:5B:
C0:BF:F1:D6:89:6C:C0:94:7C:02:99:50:98:BA:4C:1C:52:4F
Exiting; no certificate found and waitforcert is disabled
这个时候,你在master就可以正常签发。
[iyunv@node08 ~]# puppet agent -t
Info: Creating a new SSL key for node08.chenshake.com
Info: Caching certificate for ca
Info: Creating a new SSL certificate request for node08.chenshake.com
Info: Certificate Request fingerprint (SHA256): 50:6B:ED:AB:E4:46:49:53:3E:41:6A:DD:93:7F:5F:3F:
00:55:17:25:A0:BB:12:AF:4A:2B:89:88:5D:41:9F:86
Info: Caching certificate for node08.chenshake.com
Info: Caching certificate_revocation_list for ca
Info: Retrieving plugin
Info: Caching catalog for node08.chenshake.com
Info: Applying configuration version '1351497197'
Finished catalog run in 0.04 seconds Pre-signing 证书
就是提前在服务器端签发证书,把证书复制到客户端,这样可以避免自动签名的危险。不过很麻烦,需要你手工copy证书。创建证书的命令,和以前版本的puppet 2.6有不同,大家注意就可以。
# puppet cert generate node08.chenshake.com
node08.chenshake.com has a waiting certificate request
Signed certificate request for node08.chenshake.com
Removing file Puppet::SSL::CertificateRequest node08.chenshake.com at '/var/lib/puppet/ssl/ca/requests/node08.chenshake.com.pem'
Removing file Puppet::SSL::CertificateRequest node08.chenshake.com at '/var/lib/puppet/ssl/certificate_requests/node08.chenshake.com.pem'
客户端操作
# puppet agent -t
Info: Caching certificate_revocation_list for ca
Info: Retrieving plugin
Info: Caching catalog for node08.chenshake.com
Info: Applying configuration version '1351735593'
Finished catalog run in 0.04 seconds
mysql -uroot -ppassword <<EOF
CREATE DATABASE dashboard CHARACTER SET utf8;
CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';
FLUSH PRIVILEGES;
EOF Passenger+Apache+Dashboard
这是让Apache支持ruby,
cd /usr/share/puppet-dashboard
# rake RAILS_ENV=production reports:import
(in /usr/share/puppet-dashboard)
Importing 7 reports from /var/lib/puppet/reports/ in the background
Importing: 100% |#########| Time: 00:00:00
7 of 7 reports queued
这时候你访问Dashboard,可以看到导入的任务.
Foreman
目前Puppet 3.0和Foreman 1.0还有问题,官方正在解决中
http://theforeman.org/issues/1872
Posted by 陈沙克 at 3:19 PM Tagged with: puppet
6 Responses to “Puppet学习笔记(CentOS6.3+Puppet3.01)”
hongna says:
2012/10/30 at 2:41 PM hi,陈老师,你好,我看了你的很多有关云技术的博文,我现在也在做这方面的工作,从最简单的如何用devstack搭建环境,或者单独搭建某些云服务,还研究过puppet,jenkins等等,希望有时间多跟你请教请教。现在我们有个需求,要搭建https://jenkins.openstack.org 这么一个测试框架,但是我看了看他整合了好多东东在里边,比如gate-nova-python26这条case,他用到openstack-ci-puppet工程,但是run的这些脚本/usr/local/jenkins/slave_scripts/gerrit-git-prep.sh review.openstack.org 是如何安装上去,从哪里来的,我真实一头雾水,希望能跟你交流下,能给下你的Email吗?
Reply
在CentOS 6.4上安装Puppet配置管理工具 | CactiFans says:
2013/05/05 at 9:48 PM [...] 上篇说了下在ubuntu12.04上安装puppet,安装的版本为puppet2.7.11版本,今天尝试了下在CentOS6.4系统上安装puppet 3.1.1版本,本文参考chenshake的文章 [...]
张跃 says:
2013/09/23 at 6:04 PM 我在http://docs.puppetlabs.com/guides/platforms.html#ruby-versions 文档里面看的是这样的包依赖关系,请问你也是安装的puppet3 怎么可以用ruby1.8.5呢??
Ruby versionPuppet 2.6Puppet 2.7Puppet 3.x
1.8.5*SupportedSupportedNo
1.8.7SupportedSupportedSupported
2.0.0**NoNoSupported (3.2 and higher)
1.9.3**NoNoSupported
Reply
lexunix says:
2013/10/16 at 11:12 PM 陈老师好,我的环境是x64 centos6.4,rdo安装的openstack(packstack –allinone安装),脚本执行过程中报以错误说 httpd服务没有启动,(猜想是我安装之前没有停用iptables和selinux引起的 因为我运行 service httpd status 发现是running状态)然后发现我的dashboard和nagios是能正常登陆的(没有节点的信息) 我想问这个影响到什么吗,有什么建议 望指正,谢谢
Reply
陈沙克 says:
2013/10/17 at 1:50 AM 应该是不会的,你反复多次就可以。rdo是完全支持selinux和iptables。确保你按照我的步骤。
Reply
zhaozhe says:
2014/01/04 at 2:24 PM 陈老师好,我想请问puppet如何使用puppet kick推送到puppet客户端?我尝试根据puppet的官方文档去配置,第一次推送成功,但是第二次推送的时候返回下面的字段
Getting status
status is running
Host test is already running
test finished with exit code 3
Failed: test
我在客户端查看了已经监听了8139端口,不明白为什么说Host test is already running,是不是要每次推送都要关闭puppet客户端?
Reply
Leave a Reply
Name (required)
E-mail (required)
Website
Your Comment