安装并试用puppet

[b]0.服务器配置[/b]
服务器2台,安装rhel5.1
服务端10.10.8.87
客户端10.10.8.81

1)务必在服务端的hosts加入对客户端ip的识别
10.10.8.87操作:
vi /etc/hosts
加入
10.10.8.81 client.81


2)务必在客户端的hosts加入对服务端ip的识别
10.10.8.81操作:
vi /etc/hosts
加入
10.10.8.87 puppet


3)务必服务器的时间都正确
分别在各服务器执行
ntpdate 210.72.145.44


[b]1.源码安装[/b]
服务端和客户端均安装
1)安装ruby
tar xf ruby-1.8.6-p114.tar.gz
cd ruby-1.8.6-p114
./configure
make && make install


2)安装facter
tar xf facter-1.6.2.tar.gz
cd facter-1.6.2
ruby install.rb


3)安装puppet
tar xf puppet-2.7.5.tar.gz
cd puppet-2.7.5
ruby install.rb


[b]2.服务端配置[/b]
1)拷贝基本配置文件,如果有了就不用拷贝了
mkdir /etc/puppet
cp conf/auth.conf /etc/puppet/
cp conf/redhat/fileserver.conf /etc/puppet/
cp conf/redhat/puppet.conf /etc/puppet/


2)加入一个测试的同步内容
mkdir -p /etc/puppet/manifests
vi /etc/puppet/manifests/site.pp
加入
file {
"/tmp/test":
content=>"test1234",
owner=>"root",
group=>"root",
mode=>644;
}


3)创建puppet账号
puppetmasterd --mkusers


[color=red]4)启动[/color]
前台运行可查询错误信息:
puppetmasterd --no-daemonize -d -v

看到以下信息并且没有报错说明启动成功了:
notice: Starting Puppet master version 2.7.5
debug: No modules mount given; autocreating with default permissions
debug: No plugins mount given; autocreating with default permissions
debug: Finishing transaction -607803008

此时会占用8140端口

[b]3.客户端配置[/b]
1)拷贝基本配置文件,如果有了就不用拷贝了
mkdir /etc/puppet
cp conf/auth.conf /etc/puppet/
cp conf/namespaceauth.conf /etc/puppet/
cp conf/redhat/puppet.conf /etc/puppet/


修改/etc/puppet/namespaceauth.conf

[fileserver]
allow *

[puppetmaster]
allow *

[puppetrunner]
allow *

[puppetbucket]
allow *

[puppetreports]
allow *

[resource]
allow *


2)创建puppet账号
puppetmasterd --mkusers


[color=red]3)同步[/color]
第一次同步需要从服务端申请证书
puppetd --server puppet --test --certname client.81

puppet为hosts配置的服务端别名,--certname指定了证书名称为client.81,如果不指定,可能会使用localhost.localdomain,这样会和服务端的证书名称冲突造成错误。
成功的话,会出现类似的提示:
info: Creating a new SSL key for client.81
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for ca
warning: peer certificate won't be verified in this SSL session
info: Creating a new SSL certificate request for client.81
info: Certificate Request fingerprint (md5): 20:15:D9:AD:96:4B:FB:F2:C4:91:F2:35:D3:23:62:C7


此时需要切换到服务端进行授权:
puppetca --list
client.81

对client.81进行授权:
puppetca -s client.81


成功之后在客户端进行再次同步:
puppetd --server puppet --test --certname client.81

成功的话,会出现类似的提示:
info: Caching catalog for client.81
info: Applying configuration version '1318447786'
notice: /Stage[main]//File[/tmp/test]/ensure: defined content as '{md5}16d7a4fca7442dda3ad93c9a726597e4'
notice: Finished catalog run in 0.03 seconds

它提示我们已经同步了/tmp/test文件,查看其内容:
cat /tmp/test
test1234

同步的内容在服务端的/etc/puppet/manifests/site.pp指定了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值