设为首页 收藏本站
查看: 4720|回复: 0

[经验分享] 运维利器-puppet集中配置管理系统安装测试[转]

[复制链接]

尚未签到

发表于 2015-9-16 11:26:37 | 显示全部楼层 |阅读模式
  运维利器-puppet集中配置管理系统安装测试
  环境:
192.168.128.128               puppet-server
192.168.128.32                puppet-client

1,安装前准备工作
puppet是ruby写的程序,依赖ruby环境,rpm -qa|grep ruby检查是否安装,若没安装,可挂载本地光盘或者在线yum安装:
[iyunv@localhost ~]# yum install -y ruby-libs ruby ruby-irb ruby-rdoc

[iyunv@localhost ~]# hostname puppet-server        #客户端为puppet-client
[iyunv@localhost ~]# vi /etc/hosts
127.0.0.1       localhost.localdomain localhost puppet-server #客户端为puppet-client
::1             localhost6.localdomain6 localhost6
192.168.128.32  puppet-client      #客户端为192.168.128.128  puppet-server
[iyunv@localhost ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=puppet-server     #客户端为puppet-client
[iyunv@localhost ~]# vi /etc/resolv.conf
; generated by /sbin/dhclient-script
#search localdomain        #注释这行,大部分的文章都没写这一步,造成无法认证;
nameserver 192.168.128.2
修改完以上文件,退出重新登录。

2,puppet-server安装配置
[iyunv@puppet-server ~]# cd /usr/local/src/
[iyunv@puppet-server src]# tar zxf facter-1.6.8.tar.gz
[iyunv@puppet-server src]# tar zxf puppet-2.6.14.tar.gz
[iyunv@puppet-server src]# cd facter-1.6.8
[iyunv@puppet-server facter-1.6.8]# ruby install.rb
[iyunv@puppet-server facter-1.6.8]# cd ../puppet-2.6.14
[iyunv@puppet-server puppet-2.6.14]# ruby install.rb
[iyunv@puppet-server puppet-2.6.14]# cp conf/redhat/fileserver.conf /etc/puppet/
[iyunv@puppet-server puppet-2.6.14]# cp conf/redhat/puppet.conf /etc/puppet/
[iyunv@puppet-server puppet-2.6.14]# cp conf/redhat/server.init /etc/init.d/puppetmaster
[iyunv@puppet-server puppet-2.6.14]# chmod +x /etc/init.d/puppetmasterd
[iyunv@puppet-server puppet-2.6.14]# chkconfig --add puppetmasterd
[iyunv@puppet-server puppet-2.6.14]# chkconfig --level 35 puppetmasterd on
[iyunv@puppet-server puppet-2.6.14]# mkdir /etc/puppet/manifests
[iyunv@puppet-server puppet-2.6.14]# puppetmasterd --mkusers
[iyunv@puppet-server puppet-2.6.14]# /etc/init.d/puppetmasterd start

3,puppet-client安装配置
[iyunv@puppet-client ~]# cd /usr/local/src/
[iyunv@puppet-client src]# tar zxf facter-1.6.8.tar.gz
[iyunv@puppet-client src]# tar zxf puppet-2.6.14.tar.gz
[iyunv@puppet-client src]# cd facter-1.6.8
[iyunv@puppet-client facter-1.6.8]# ruby install.rb
[iyunv@puppet-client facter-1.6.8]# cd ../puppet-2.6.14
[iyunv@puppet-client puppet-2.6.14]# ruby install.rb
[iyunv@puppet-client puppet-2.6.14]# cp conf/namespaceauth.conf /etc/puppet/
[iyunv@puppet-client puppet-2.6.14]# cp conf/redhat/puppet.conf /etc/puppet/
[iyunv@puppet-client puppet-2.6.14]# cp conf/redhat/client.init /etc/init.d/puppetd
[iyunv@puppet-client puppet-2.6.14]# chmod +x /etc/init.d/puppetd
[iyunv@puppet-client puppet-2.6.14]# chkconfig --add puppetd
[iyunv@puppet-client puppet-2.6.14]# chkconfig --level 35 puppetd on
[iyunv@puppet-client puppet-2.6.14]# puppetd --mkusers #创建用户报错,以下手动创建
[iyunv@puppet-client puppet-2.6.14]# groupadd puppet
[iyunv@puppet-client puppet-2.6.14]# useradd -g puppet -M puppet
[iyunv@puppet-client puppet-2.6.14]# /etc/init.d/puppetd start

4,签名认证
客户端发送请求:
[iyunv@puppet-client puppet-2.6.14]# puppetd --test --server puppet-server
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for ca
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
info: Creating a new SSL certificate request for puppet-client
info: Certificate Request fingerprint (md5): FB:5F:4B:05:8E:56:7F:A0:71:B0:59:6C:19:E5:A8:C4
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
Exiting; no certificate found and waitforcert is disabled

服务器端查看认证请求:
[iyunv@puppet-server ~]# puppetca -l
  puppet-client (FB:5F:4B:05:8E:56:7F:A0:71:B0:59:6C:19:E5:A8:C4)

认证单个客户端:
[iyunv@puppet-server ~]# puppetca -s puppet-client
notice: Signed certificate request for puppet-client
notice: Removing file Puppet::SSL::CertificateRequest puppet-client at '/var/lib/puppet/ssl/ca/requests/puppet-client.pem'

认证所有客户端:
[iyunv@puppet-server ~]# puppetca -s -a

客户端再次执行,已完成认证:
[iyunv@puppet-client puppet-2.6.14]# puppetd --test --server puppet-server
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for puppet-client
info: Caching certificate_revocation_list for ca
info: Caching catalog for puppet-client
info: Applying configuration version '1337769948'
info: Creating state file /var/lib/puppet/state/state.yaml
notice: Finished catalog run in 0.01 seconds

5,最简单测试:修改客户端文件权限
服务器端添加主配置文件site.pp:
[iyunv@puppet-server ~]# vi /etc/puppet/manifests/site.pp
file
{       "/root/install.log":
         owner => "puppet",
         group => "puppet",
         mode => 666,
}

DSC0000.jpg
  
客户端执行命令:
[iyunv@puppet-client ~]# puppetd --test --server puppet-server

客户端/root/install.log文件执行前后属主权限变化:
DSC0001.jpg
  
刚刚接触puppet,后续将深入配置实例演示……
  ps
  我与本文的作者安装的稍微有些出入,我添加了epel源之后,直接yum search puppet ,然后安装yum install puppet-server,后面的facter也是可以用yum安装的,node节点与server认证,以及测试的时候,我参考了本文的作者的例子!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-114412-1-1.html 上篇帖子: yum subversion puppet puppet-server 下篇帖子: Puppet's Commands 3.7
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表