Puppet 3 出来这么久了还没摸过. 这里备忘下puppet 3.x的安装笔记, puppet3.x 相对于 puppet 2.x 有很大的性能提升和对执行入口的统一puppet, 这更方便也更佳实用的.
这次安装平台是centos上, puppet 是基于ruby开发的一个集中配置管理系统, 所以需要确保ruby已经. 安装基础设施 ruby (这里使用rvm) 直接使用最新的ruby 2.0.x: (关于 rvm 管理器: @SEE: https://rvm.io/rvm/install/)
$ curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby
puppet 需要通过factor获取服务器的变量, 而且这个得单独下载安装. 安装当下的最新的 facter 包:
$ wget http://puppetlabs.com/downloads/facter/facter-1.7.1.tar.gz $ tar xzf facter-1.7.1.tar.gz && cd facter-1.7.1 $ ruby install.rb
安装 puppet 3.2.1 包(不管了, 都往最新的整):
$ wget http://puppetlabs.com/downloads/puppet/puppet-3.2.1.tar.gz $ tar xzf puppet-3.2.1.tar.gz && cd puppet-3.2.1 $ ruby install.rb
Puppet 安装很是简单, 就需要上面这么几步就搞定了, 接下来需要做的基本就只有Client签名认证和puppet的节点(node)配置了, 因为我想要的是在同一台上开启master和agent(Puppet系统体系结构模式是C/S模式).
先让我们来先测试签名, puppet的所有签名都牵扯到主机名hostname, 所以这个得事先配置好(这里的事先是指安装puppet之前).
开启 puppet master服务
(先不要放在后台加上 –no-daemonize, 方便我们测试):
$ puppet master -d --no-daemonize --debug --verbose
开启另一shell以puppet客户端身份发送签名申请:
$ puppet agent --test --server `hostname` --debug
发送签名申请的时候注意服务窗口的响应, 如果出现 Warning: Could not retrieve fact fqdn 的话, 不用管它. 很有可能是你的 hostname 是一个根域格式, 如: hostname 为 ‘ay1212241209323e89373′ 的时候. 设置成像 xxx.com 这种格式就不会有了.
... Info: access[/certificate/ca]: adding authentication any Info: access[/certificate/ca]: allowing 'method' find Info: access[/certificate/ca]: allowing * access Info: access[/certificate/]: adding authentication any Info: access[/certificate/]: allowing 'method' find Info: access[/certificate/]: allowing * access Info: access[/certificate_request]: adding authentication any Info: access[/certificate_request]: allowing 'method' find Info: access[/certificate_request]: allowing 'method' save Info: access[/certificate_request]: allowing * access Info: access[/]: adding authentication any Info: Inserting default '/status' (auth true) ACL Info: Caching node for ay1212241209323e89373 Debug: Warning: calling Plugins.search with empty module path. Warning: Could not retrieve fact fqdn Info: Caching node for ay1212241209323e89373 Debug: Finishing transaction 75406460 Debug: Received report to process from ay1212241209323e89373 Debug: Processing report from ay1212241209323e89373 with processor Puppet::Reports::Store
签名请求已经发送了, 就等授权了. 运行列出刚才申请的客户机:
$ puppet cert list --all
会出现一个列表, 里面就有一个你的一个hostname 我这里是 ay1212241209323e89373, 同意签名:
$ puppet cert sign ay1212241209323e89373 -d
注意, 这里有个需要注意的是, 你的主机名不能含有大写字母的, 所以你配置你的hostname的时候需要小心, 要不然会出现下面的问题:
Error: Could not find certificate request for ay1212241209323e89373
确认签名后, 手动修改 puppet node的配置. 默认安装在/etc/puppet 下, 这里面就不细说这个配置了, 详细请见puppet官方文档!
最后Puppet agent测试:
$ puppet agent --no-daemonize --server `hostname` --debug
ok :)
Info: Caching node for ay1212241209323e89373
Debug: importing ‘/etc/puppet/manifests/nodes.pp’ in environment production
Warning: Host is missing hostname and/or domain: ay1212241209323e89373
暂无评论
写评论