puppet项目计划之(服务端与客户端测试篇)
1、服务端启动服务
[root@masterrun]# netstat -ntpl|grep 8140
tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 15690/ruby
[root@masterrun]# ps -ef|grep puppet|grep -v grep
puppet 15690 1 0 17:04 ? 00:00:00 /usr/bin/ruby/usr/sbin/puppetmasterd
2、检测是否有客户端的请求
[root@master run]# puppetca -l
"agent.kylinyunwei.com"(AA:EF:AC:D4:B6:27:5D:2D:D7:77:24:0B:33:FF:0D:45)
3、服务端颁发证书
[root@master run]# puppetca -sagent.kylinyunwei.com
notice:Signed certificate request for agent.kylinyunwei.com
notice:Removing file Puppet::SSL::CertificateRequest agent.kylinyunwei.com at'/etc/puppet/ssl/ca/requests/agent.kylinyunwei.com.pem'
[root@masterrun]# puppetca -a --list
+"agent.kylinyunwei.com" (CC:E1:AC:5D:0E:80:74:DE:66:F0:C9:2A:87:35:3C:4F)
+"kylinyunwei-server" (F9:20:B1:99:0F:06:98:B2:20:96:B0:79:50:E5:20:86)
+"master.kylinyunwei.com"(21:24:8D:E1:6E:73:BD:62:9B:26:21:18:ED:5F:A8:3A) (alt names:"DNS:master.kylinyunwei.com", "DNS:puppet","DNS:puppet.kylinyunwei.com")
4、客户端进行测试,建立连接请求
[root@agentpuppet]# puppetd --test --servermaster.kylinyunwei.com
Exiting;no certificate found and waitforcert is disabled
[root@agentpuppet]# puppetd --test --server master.kylinyunwei.com
Exiting;no certificate found and waitforcert is disabled
[root@agentpuppet]# puppetd --test --server master.kylinyunwei.com
notice:Ignoring --listen on onetime run
info:Caching catalog for agent.kylinyunwei.com
info:Applying configuration version '1413882810'
notice:Finished catalog run in 0.02 seconds
5、功能测试
服务端:
建立pp文件测试
puppet的第一个执行的代码是在/etc/puppet/manifest/site.pp
因此这个文件必须存在,而且其他的代码也要通过代码来调用.
[root@server~]# vim /etc/puppet/manifests/site.pp
nodedefault {
file{"/tmp/viong.txt":
content=>"good,testpass!\n";}
}
初次创建pp文件,需要重启puppetmaster
[root@master~]# service puppetmaster restart
客户端
[root@agenttmp]# puppetd --test --servermaster.kylinyunwei.com
notice:Ignoring --listen on onetime run
info:Caching catalog for agent.kylinyunwei.com
info:Applying configuration version '1413885958'
notice:/Stage[main]//Node[default]/File[/tmp/viong.txt]/ensure: defined content as'{md5}4750aa5be82dae5db286a5859700dd51'
notice:Finished catalog run in 0.06 seconds
成功的话就会显示puppet反馈一些调试信息,并在/tmp目录下创建了 /tmp/viong.txt文件
[root@agent~]# cat /tmp/viong.txt
good,testpass!
[root@agent~]#