配置
配置主机名(服务器端,客户端同样处理)
vi /etc/sysconfig/network

hostname设置成自己想要的,一般情况不动就可以
可以运行hostname查看。
vi /etc/hosts,把服务器客户端的ip以及对应的主机名都加进去。

呵呵。。。这样就配完了。。我一开始还错了。
接下来就是启动和链接了。
服务器端启动
/etc/init.d/puppetmasterd start
检查
netstat -anpt | grep 8140

客户端启动
/etc/init.d/puppet start
检查
netstat -an | grep 8139
客户端向服务端申请证书
puppetd --test --server Hehe
info: Caching certificate for ca
info: Creating a new SSL certificate request for agent165.jiu.com
info: Certificate Request fingerprint (md5): BC:9C:93:4C:8E:71:8A:EB:E0:1E:F0:99:DC:37:BA:E5
Exiting; no certificate found and waitforcert is disabled
服务端审批证书
puppetca -s localhost.localdomain
这样就好了。
下面测试
puppet同步管理功能测试。puppet文件需要在/etc/puppet/manifests/site.pp中写任务。
[root@master ~]# cd /etc/puppet/manifests/
[root@master manifests]# more site.pp
node default{
file {"/tmp/Puppet_test.txt":
content => "My english name is Taokey.";}
}
重新启动下puppet。
[root@master ~]# /etc/init.d/puppetmasterd restart
停止 puppetmaster: [确定]
启动 puppetmaster: [确定]
[root@master ~]# chmod +x /etc/puppet/manifests/site.pp
[root@master ~]# /etc/puppet/manifests/site.pp
/etc/puppet/manifests/site.pp: line 1: node: command not found
/etc/puppet/manifests/site.pp: line 2: file: command not found
/etc/puppet/manifests/site.pp: line 3: syntax error near unexpected token `}'
/etc/puppet/manifests/site.pp: line 3: `content => "My english name is Taokey.";}'
在客户端同步任务,默认是半个小时同步一次。
[root@agent165 ~]# puppetd --test --server master.jiu.com
info: Caching catalog for agent165.jiu.com
info: Applying configuration version '1398159168'
notice: /Stage[main]//Node[default]/File[/tmp/Puppet_test.txt]/content:
--- /tmp/Puppet_test.txt 2014-04-22 17:11:09.000000000 +0800
+++ /tmp/puppet-file.28330.0 2014-04-22 17:32:33.000000000 +0800
@@ -1 +1 @@
- taokey are handsome
\ No newline at end of file
+My english name is Taokey.
\ No newline at end of file
info: FileBucket adding {md5}f8b6f91540f80377f00e8e73bed18992
info: /Stage[main]//Node[default]/File[/tmp/Puppet_test.txt]: Filebucketed /tmp/Puppet_test.txt to puppet with sum f8b6f91540f80377f00e8e73bed18992
notice: /Stage[main]//Node[default]/File[/tmp/Puppet_test.txt]/content: content changed '{md5}f8b6f91540f80377f00e8e73bed18992' to '{md5}4e616a37997cf68dd0f15702af9ceca1'
notice: Finished catalog run in 0.14 seconds
查看agent165这台服务器是否生成相应文件。
[root@agent168 ~]# more /tmp/Puppet_test.txt
My english name is Taokey.
到此为止,实验结束。
Puppet 的详细介绍:请点这里
Puppet 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-06/103129.htm
