查看同步时间
# puppet agent --configprint runinterval
10
查看执行过程
# puppet agent --test --noop
notice: Ignoring --listen on onetime run
info: Caching catalog for client.cbcv.net
info: Applying configuration version '1353490380'
notice: Finished catalog run in 0.05 seconds
======================= 1 配置客户端自动同步
10s自动同步
listen = true ##这个是让puppet监听8139端口。
#vim /etc/puppet/puppet.conf
[agent]
server = server.cbcv.net
listen = true
report = true
runinterval = 10
#service puppet restart
=======================
2 puppetrun的使用
原理:
服务器端触发同步到客户端
【配置步骤】
1.修改客户端上的puppet的配置文件
#vim /etc/puppet/puppet.conf
[agent]
server = server.cbcv.net
listen = true
report = true
runinterval = 10
#service puppet restart
3.创建namespaceauth.conf这个文件,添加如下内容:
vim /etc/puppet/namespaceauth.conf
[puppetrunner]
allow *
vim /etc/puppet/auth.conf
在path /之前添加下内容,加粗部分:
path /run
method save
allow *
path /
auth any
4.配置完成后,启动puppet客户端。
/etc/init.d/puppet start
到此,puppet客户端已经配置完成,确保防火墙已开启8319端口,
为方便测试,可以关掉防火墙。接下来就进行测试。
[服务器端测试]
# puppetrun -p 10 --host client.cbcv.net
Triggering client.cbcv.net
Getting status
status is success
client.cbcv.net finished with exit code 0
Finished
已经成功运行。关于puppetrun用法,可以使用puppetrun --help进行查看。
【故障排查】
1.查看puppet的相关日志输出:
#tail -f /var/log/message
2.查看puppet 客户端进程是否开启:
#ps axf |grep puppet|grep -v grep
21045 ? Ssl 0:01 /usr/bin/ruby /usr/sbin/puppetd --server=puppet
请注意查看,有没有server=你puppetmaster主机名的,这串。
3.查看8139端口是否监听:
#netstat -nltp|grep 8139
tcp 0 0 0.0.0.0:8139 0.0.0.0:* LISTEN 21045/ruby
4.确认防火墙是否开启,或者从别的机器,telnet客户端的8139端口是否能连通。
#service iptables stop ##关闭防火墙
#telnet IP 8139 ## IP为客户端机器的IP
[总结]
puppetrun 2.6版本是这个命令,2.7版本里为puppet kick ,puppetrun可以使主控端对任意客户端
运行puppet操作。puppetrun 不能运行系统命令,如需要运行系统命令,则需要安装MC,另外加
相应的插件,可以对客户端软件包,进程状态,或者执行系统命令,进行全方位的操作。