centos5.4-64bit puppet安装

刚研究出来的 算做个记录吧 puppet的作用自己查查吧 服务器多了起来 相信它可以帮你我告别那些重复没有太多技术含量的工作

  
  
  
  
  1. puppet的安装以及简单的应用 
  2. 参考连接 http://chinaapp.sinaapp.com/thread-2062-1-1.html 
  3.          http://chinaapp.sinaapp.com/thread-2062-1-1.html 
  4.          http://blog.csdn.net/kumu_linux/article/details/7655043 
  5.          http://gehailong.blog.51cto.com/765312/754711 
  6. 对应的yum源 http://yum.puppetlabs.com/el/5/products/x86_64/ 
  7.  
  8. 系统配置:centos5.4 64bit  selinux 0  iptables关闭 
  9. 服务端ip 192.168.202.132  hostnmae: master.puppet.com 
  10. 客户端ip 192.168.202.133  hostname: client1.puppet.com 
  11. ############################ puppet服务端配置 
  12. 一 修改主机名 
  13. [root@master ~]# vim/etc/sysconfig/network 
  14. NETWORKING=yes 
  15. NETWORKING_IPV6=no 
  16. HOSTNAME=master.puppet.com 
  17. 修改hosts文件 
  18. [root@master ~]# vim /etc/hosts 
  19. # Do not remove the following line, or various programs 
  20. # that require network functionality will fail. 
  21. 127.0.0.1       localhost.localdomain localhost 
  22. ::1     localhost6.localdomain6 localhost6 
  23. 192.168.202.132  master.puppet.com       master 
  24. 192.168.202.133  clent1.puppet.com       client1 
  25. 使修改生效 
  26. /etc/init.d/network restart 
  27.  
  28. 二安装ruby环境 
  29. 1 首先导入系统对应的yum源 里面包含ruby puppet-server puppet facter 
  30. rpm -ivh http://yum.puppetlabs.com/el/5/products/x86_64/puppetlabs-release-5-5.noarch.rpm 
  31. root@clent1 tmp]# cd /etc/yum.repos.d/ 
  32. [root@clent1 yum.repos.d]# ls 
  33. CentOS-Base.repo  CentOS-Media.repo  puppetlabs.repo(会生成这个) 
  34.  
  35. 2 安装ruby 我安装的是这么多 之前用源码安装的没有安装shadow augeas 然后连接报错(不知跟这有没有关系) 
  36. yum install ruby.x86_64 ruby-augeas.x86_64 ruby-devel.x86_64 ruby-docs.x86_64 ruby-irb.x86_64 ruby-libs.x86_64 ruby-rdoc.x86_64 ruby-shadow.x86_64  
  37.  
  38. 3 检测是否安装成功 
  39. [root@clent1 tmp]# ruby -v 
  40. ruby 1.8.5 (2006-08-25) [x86_64-linux] 
  41.  
  42. 三安装puppet-server 
  43. 1 这里会安装facter puppet puppet-server  
  44. yum install puppet-server 
  45.  
  46. 2启动服务 
  47. /etc/init.d/puppetmaster start 
  48. [root@master manifests]# ps -ef | grep puppet 
  49. puppet   21293     1  0 23:08 ?        00:00:04 /usr/bin/ruby /usr/sbin/puppetmasterd 
  50. root     22301 20746  0 23:46 pts/5    00:00:00 grep puppet 
  51.  
  52.  
  53. #############################客户端配置 
  54. 一 修改主机名 
  55. [root@master ~]# vim/etc/sysconfig/network 
  56. NETWORKING=yes 
  57. NETWORKING_IPV6=no 
  58. HOSTNAME=clent1.puppet.com 
  59. 修改hosts文件 
  60. [root@master ~]# vim /etc/hosts 
  61. # Do not remove the following line, or various programs 
  62. # that require network functionality will fail. 
  63. 127.0.0.1       localhost.localdomain localhost 
  64. ::1     localhost6.localdomain6 localhost6 
  65. 192.168.202.132  master.puppet.com       master 
  66. 192.168.202.133  clent1.puppet.com       client1 
  67. 使修改生效 
  68. /etc/init.d/network restart 
  69.  
  70. 二安装ruby环境 
  71. 1 首先导入系统对应的yum源 里面包含ruby puppet-server puppet facter 
  72. rpm -ivh http://yum.puppetlabs.com/el/5/products/x86_64/puppetlabs-release-5-5.noarch.rpm 
  73. root@clent1 tmp]# cd /etc/yum.repos.d/ 
  74. [root@clent1 yum.repos.d]# ls 
  75. CentOS-Base.repo  CentOS-Media.repo  puppetlabs.repo(会生成这个) 
  76.  
  77. 2 安装ruby 我安装的是这么多 之前用源码安装的没有安装shadow augeas 然后连接报错(不知跟这有没有关系) 
  78. yum install ruby.x86_64 ruby-augeas.x86_64 ruby-devel.x86_64 ruby-docs.x86_64 ruby-irb.x86_64 ruby-libs.x86_64 ruby-rdoc.x86_64 ruby-shadow.x86_64  
  79.  
  80. 3 检测是否安装成功 
  81. [root@clent1 tmp]# ruby -v 
  82. ruby 1.8.5 (2006-08-25) [x86_64-linux] 
  83.  
  84. 三安装puppet 
  85. 这里会安装facter puppet 
  86. yum install puppet 
  87.  
  88.  
  89.  
  90. 客户端执行 申请证书(测试的时候最好把selinux iptables关闭) 
  91. [root@clent1 ~]# puppetd --server master.puppet.com --test (下面这中信息是没有错误的) 
  92. info: Creating a new SSL key for clent1.puppet.com 
  93. info: Caching certificate for ca 
  94. info: Creating a new SSL certificate request for clent1.puppet.com 
  95. info: Certificate Request fingerprint (md5): FB:5C:3F:C9:1E:DD:62:79:82:81:C3:20:2C:71:58:3C 
  96. Exiting; no certificate found and waitforcert is disabled 
  97.  
  98. 然后服务端颁发证书执行 
  99. [root@master ~]# puppetca --list 查看那些主机需要连接 
  100.   "clent1.puppet.com" (FB:5C:3F:C9:1E:DD:62:79:82:81:C3:20:2C:71:58:3C) 
  101. [root@master ~]# puppetca -s  client1.puppet.com 颁发证书报错 
  102. err: Could not call sign: Could not find certificate request for client1.puppet.com 
  103. Could not find certificate request for client1.puppet.com 
  104.  
  105. [root@master ~]# puppetca --list 
  106.   "clent1.puppet.com" (FB:5C:3F:C9:1E:DD:62:79:82:81:C3:20:2C:71:58:3C) 
  107. [root@master ~]# puppetca --sign  client1.puppet.com 用这种方法还是不行 
  108. err: Could not call sign: Could not find certificate request for client1.puppet.com 
  109. Could not find certificate request for client1.puppet.com 
  110. [root@master ~]# puppetca -s -a 用这个方法颁发证书 提示如下表明正确 
  111. notice: Signed certificate request for clent1.puppet.com 
  112. notice: Removing file Puppet::SSL::CertificateRequest clent1.puppet.com at '/var/lib/puppet/ssl/ca/requests/clent1.puppet.com.pem' 
  113. 然后客户端执行如下操作 获得证书 
  114. [root@clent1 ~]# puppetd --server master.puppet.com --test 
  115. Exiting; no certificate found and waitforcert is disabled 
  116. [root@clent1 ~]# puppetd --server master.puppet.com --test 
  117. info: Caching certificate for clent1.puppet.com 
  118. info: Caching certificate_revocation_list for ca 
  119. info: Caching catalog for clent1.puppet.com 
  120. info: Applying configuration version '1346739497' 
  121. info: Creating state file /var/lib/puppet/state/state.yaml 
  122. notice: Finished catalog run in 0.04 seconds 
  123.  
  124. ********简单的测试看是否成功 
  125. puppet服务端 
  126. cd /etc/puppet/manifests  
  127. 新建一个文件site.pp 内容如下 (就是建立一个文件 /tmp/a.txt内容为content对应的 对应的权限 所有者 所有组) 
  128. [root@master manifests]# vim site.pp  
  129. node default { 
  130. file{"/tmp/a.txt": 
  131. content => "helo,I am abc.bbb!abc.aaa \n bbbbbb \n cccc \n dddd \n", 
  132. ensure  => present, 
  133. mode => 644, 
  134. owner => root, 
  135. group => root, 
  136.  
  137. 客户端 
  138. [root@clent1 ~]# puppetd --server master.puppet.com --test 看到如下信息 提示创建了/tmp/a.txt 
  139. info: Caching catalog for clent1.puppet.com 
  140. info: Applying configuration version '1346739912' 
  141. notice: /Stage[main]//Node[default]/File[/tmp/a.txt]/ensure: created 
  142. notice: Finished catalog run in 0.06 seconds 
  143.  
  144. 看看内容 权限是不是正确 
  145. [root@clent1 tmp]# ll 
  146. total 52 
  147. -rw-r--r-- 1 root root   50 Sep  3 23:25 a.txt 
  148. drwx------ 2 root root 4096 Sep  3 20:33 gconfd-root 
  149. srwxr-xr-x 1 root root    0 Sep  3 20:25 mapping-root 
  150. drwxr-xr-x 2 root root 4096 Sep  4  2012 vmware-config0 
  151. drwxrwxrwt 2 root root 4096 Sep  4  2012 VMwareDnD 
  152. drwxr-xr-x 2 root root 4096 Sep  4  2012 vmware-file-mod0 
  153. drwx------ 2 root root 4096 Sep  3 20:37 vmware-root 
  154. [root@clent1 tmp]# cat a.txt  
  155. helo,I am abc.bbb!abc.aaa  
  156.  bbbbbb  
  157.  cccc  
  158.  dddd  
  159.   
  160.   
  161.  刚研究出来 这只是简单的应用 
  162.   

 

你可能感兴趣的:(puppet,centos5.4)