欢迎访问www.showerlee.com, 您的支持就是我前进的动力.

Centos6.3下Puppet安装配置笔记

showerlee 2013-08-24 20:12 PUPPET 阅读 (3,832) 抢沙发

----------闲扯---------------  

最近抽空研究了下据说是圈里运维利器的国外开源软件puppet,原本是想搞一个最新版本编译的整合文档,最后在调试过程中各种报错,google下老外的文章,说是最新版本间存在很多不兼容的情况,后来果断放弃,找到了一个能兼容的版本,并测试成功,前后折腾了2天,真够坑的,现在把自己的心得整合成文档,供大家分享。

---------惯例,开搞----------

系统环境:centos6.3

puppet:   puppet-2.7.13

facter:   facter-1.6.5

ruby:     yum源

注:

facter用来获取客户端系统信息(如hostname,ip,OS-Version,fqdn等)

ruby是puppet的开发环境

puppet server: 192.168.7.196

puppet client: 192.168.7.197

(server)为仅服务器端配置

(client)为仅客户器端配置

(server,client)为服务器端与客户端配置

一.配置环境(server,client):

1.关闭iptables和selinux(server,client)

# service iptables stop

# setenforce 0

# vi /etc/sysconfig/selinux

---------------

SELINUX=disabled

---------------

2.安装ruby开发环境(centos6.3默认更新源)(server,client)

# yum -y install ruby*

3.计划同步时间:(server,client)

每5分钟同步一次时间

# crontab -e

-------------

*/5 * * * * /usr/sbin/ntpdate -u asia.pool.ntp.org

-------------

# service crond restart

# chkconfig crond on

4.修改服务器及客户端HOST及主机名:

(server,client)

# vi /etc/hosts

-------------------

192.168.7.196    server.example.com    server

192.168.7.197    client.example.com    client

-------------------

(server)

# vi /etc/sysconfig/network

----------------

HOSTNAME=server.example.com

----------------

(client)

# vi /etc/sysconfig/network

----------------

HOSTNAME=client.example.com

----------------

二.安装应用软件(server,client)

(server):

1.安装facter:

# wget http://downloads.puppetlabs.com/facter/facter-1.6.5.tar.gz

# tar zxvf facter-1.6.5.tar.gz

# cd facter-1.6.5

# ruby install.rb

2.安装puppet:

# wget http://downloads.puppetlabs.com/puppet/puppet-2.6.13.tar.gz

# tar zxvf puppet-2.6.13.tar.gz

# cd puppet-2.6.13

# ruby install.rb

# cp conf/auth.conf /etc/puppet/

# cp conf/redhat/fileserver.conf /etc/puppet/

# cp conf/redhat/puppet.conf /etc/puppet/

# mkdir -p /etc/puppet/manifests

设置开机启动脚本:

# cp conf/redhat/server.init /etc/init.d/puppetmaster

# chmod +x /etc/init.d/puppetmaster

# chkconfig --add puppetmaster

# chkconfig puppetmaster on

生成pupput用户:

# puppetmasterd --mkusers

启动puppetmaster服务(端口:8140):

# service puppetmaster start

(client):

1.安装facter:

# wget http://downloads.puppetlabs.com/facter/facter-1.6.5.tar.gz

# tar zxvf facter-1.6.5.tar.gz

# cd facter-1.6.5

# ruby install.rb

2.安装puppet:

# wget http://downloads.puppetlabs.com/puppet/puppet-2.6.13.tar.gz

# tar zxvf puppet-2.6.13.tar.gz

# cd puppet-2.6.13

# ruby install.rb

# cp conf/auth.conf /etc/puppet/

# cp conf/namespaceauth.conf /etc/puppet/

# cp conf/redhat/puppet.conf /etc/puppet/

设置开机启动脚本:

# cp conf/redhat/client.init /etc/init.d/puppet

# chmod +x /etc/init.d/puppet

# chkconfig --add puppet

# chkconfig puppet on

# vi /etc/puppet/puppet.conf

在[agent]条目下添加以下内容:

-------

Listen = true

Server = server.example.com

--------

# vi /etc/puppet/namespaceauth.conf

修改成以下内容:

---------

[fileserver]

allow *

[puppetmaster]

allow *

[puppetrunner]

allow *

[puppetbucket]

allow *

[puppetreports]

allow *

[resource]

allow *

---------

生成pupput用户:

# puppetmasterd --mkusers

启动puppet服务(端口:8140):

# /etc/init.d/puppet start

至此安装完毕,现在需要配置客户端与服务器端的认证连接,从而将服务器端的配置的内容分发到各个客户端,实现集中配置管理。

三.认证并分发:


(client):

客户端发送请求

# puppetd --test --server server.example.com

报错:

--------------------

err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0