gwuj 发表于 2018-8-2 10:56:54

puppet服务端与客户端测试篇

  puppet项目计划之(服务端与客户端测试篇)
  1、服务端启动服务
  # netstat -ntpl|grep 8140
  tcp      0   0 0.0.0.0:8140               0.0.0.0:*                   LISTEN      15690/ruby
  # ps -ef|grep puppet|grep -v grep
  puppet   15690    10 17:04 ?      00:00:00 /usr/bin/ruby/usr/sbin/puppetmasterd
  2、检测是否有客户端的请求
  # puppetca -l
  "agent.kylinyunwei.com"(AA:EF:AC:D4:B6:27:5D:2D:D7:77:24:0B:33:FF:0D:45)
  3、服务端颁发证书
  # 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'
  #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、客户端进行测试,建立连接请求
  #puppetd --test --servermaster.kylinyunwei.com
  Exiting;no certificate found and waitforcert is disabled
  # puppetd --test --server master.kylinyunwei.com
  Exiting;no certificate found and waitforcert is disabled
  # 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
  因此这个文件必须存在,而且其他的代码也要通过代码来调用.
  # vim /etc/puppet/manifests/site.pp
  nodedefault {
  file{"/tmp/viong.txt":
  content=>"good,testpass!\n";}
  }
  初次创建pp文件,需要重启puppetmaster
  # service puppetmaster restart
  客户端
  #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//Node/File/ensure: defined content as'{md5}4750aa5be82dae5db286a5859700dd51'
  notice:Finished catalog run in 0.06 seconds
  成功的话就会显示puppet反馈一些调试信息,并在/tmp目录下创建了 /tmp/viong.txt文件
  # cat /tmp/viong.txt
  good,testpass!
  #
页: [1]
查看完整版本: puppet服务端与客户端测试篇