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

[经验分享] puppet_002

[复制链接]

尚未签到

发表于 2015-9-16 12:22:33 | 显示全部楼层 |阅读模式
  http://opkeep.com/system/linux/puppet-install-2.html

快速安装Puppet
  1,921 views, Linux, by 木木.
  公认的CentOS安装软件最快的是yum,安装过程如下:
复制代码首先设置yum repositories
创建 puppet.repo





cd /etc/yum.repos.d/
vi puppet.repo
  在puppet.repo写入内容如下:





[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/base/
enabled=0
gpgcheck=0
  创建 epel.repo





cd /etc/yum.repos.d/
vi epel.repo
  在epel.repo 写入内容如下:





[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=0

[epel-puppet]
name=epel puppet
baseurl=http://tmz.fedorapeople.org/repo/puppet/epel/5/$basearch/
enabled=0
gpgcheck=0
  创建ruby.repo





cd /etc/yum.repos.d/
vi ruby.repo
  在ruby.repo 写入内容如下:





[ruby]
name=ruby
baseurl=http://repo.premiumhelp.eu/ruby/
gpgcheck=0
enabled=0
  因为puppet的是用ruby语言写的,所以要第一个安装(系统里没有安装ruby的系统)域升级ruby:





yum --enablerepo="ruby" install ruby
[上面为安装ruby命令]
下面是安装过程
[此处省略安装回显条目...]
Dependencies Resolved
================================================================================
Package             Arch           Version                Repository      Size
================================================================================
Installing:
ruby                i686           1.8.6.111-1            ruby           525 k
Installing for dependencies:
ruby-libs           i686           1.8.6.111-1            ruby           2.6 M
Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)
Total download size: 3.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ruby-1.8.6.111-1.i686.rpm                         | 525 kB     00:14
(2/2): ruby-libs-1.8.6.111-1.i686.rpm                    | 2.6 MB     01:13
--------------------------------------------------------------------------------
Total                                            33 kB/s | 3.1 MB     01:35
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : ruby-libs                                                1/2
Installing     : ruby                                                     2/2
Installed:
ruby.i686 0:1.8.6.111-1
Dependency Installed:
ruby-libs.i686 0:1.8.6.111-1
Complete!
  查询ruby安装是否成功:





ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
  安装 Puppet Server:





yum --enablerepo=epel,epel-puppet install puppet-server
  安装过程如下:





[...]
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package puppet-server.noarch 0:2.6.7-1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package              Arch          Version            Repository          Size
================================================================================
Installing:
puppet-server        noarch        2.6.7-1.el5        epel-puppet         20 k
Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)
Total download size: 20 k
Is this ok [y/N]: y
Downloading Packages:
puppet-server-2.6.7-1.el5.noarch.rpm                     |  20 kB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : puppet-server                                            1/1
Installed:
puppet-server.noarch 0:2.6.7-1.el5
Complete!
  显示puppet版本:





# puppet --version
2.6.7
  安装putpet 客户端:





#yum --enablerepo="epel,epel-puppet" install puppet
  安装全部完成; puppet在CentOS5.5上测试成功,也适用于redhat RHEL
  祝大家使用puppet愉快!
  参考http://www.craigdunn.org/2010/08/part-1-installing-puppet-2-6-1-on-centos-with-yumrpm/
  转自:http://bbs.linuxtone.org/thread-9473-1-1.html
  
  
  
  #################################################################
  http://www.craigdunn.org/2010/08/part-1-installing-puppet-2-6-1-on-centos-with-yumrpm/
  http://www.craigdunn.org/2010/08/part-2-puppet-2-6-1-configure-puppetmaster-and-puppetd/
  

Part 1: Installing puppet 2.6.1 on CentOS with YUM/RPM
  

Installing Puppetmaster 2.6.1
  Assuming, like me, the thought of letting rubygems vommit all over your filesystem is not a pleasant one, then how to get the latest puppet 2.6.1 installed on CentOS 5.5 with yum isn’t very clear. Things may differ on other peoples systems, but the below worked for me.



Set up yum repositories.
  Do this on both the client and the server
Add the following files and save them to /etc/yum.repos.d/

puppet.repo















[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/base/
enabled=0
gpgcheck=0
  
epel.repo















[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=0

[epel-puppet]
name=epel puppet
baseurl=http://tmz.fedorapeople.org/repo/puppet/epel/5/$basearch/
enabled=0
gpgcheck=0
  
ruby.repo















[ruby]
name=ruby
baseurl=http://repo.premiumhelp.eu/ruby/
gpgcheck=0
enabled=0
  
Note that we include ruby and puppetlabs as the next steps in this tutorial will be to configure puppet and install puppet-dashboard. We want to upgrade to ruby 1.8.6 in order to run puppet-dashboard, doing this now will save you some pain down the line.


Upgrade Ruby to 1.8.6
  Do this on both the client and the server
As mentioned above, use the ruby repo to upgrade.
















punch# yum --enablerepo="ruby" update ruby
[...]
==============================================================
Package            Arch          Version               Repository     Size
==============================================================
Updating:
ruby               i686          1.8.6.111-1           ruby          525 k
Updating for dependencies:
ruby-libs          i686          1.8.6.111-1           ruby          2.6 M
Transaction Summary
===============================================================
Install       0 Package(s)
Upgrade       2 Package(s)
Total download size: 3.1 M
Is this ok [y/N]: y
[...]
  

Install Puppet Server
  On your puppetmaster server:















punch# yum --enablerepo=epel,epel-puppet install puppet-server
[...]
Installing:
puppet-server        noarch      2.6.1-0.3.rc3.el5       epel-puppet       20 k
Installing for dependencies:
facter               noarch      1.5.8-0.2.rc2.el5       epel-puppet       55 k
libselinux-ruby      i386        1.33.4-5.5.el5          base              60 k
puppet               noarch      2.6.1-0.3.rc3.el5       epel-puppet      818 k
ruby-augeas          i386        0.3.0-1.el5             epel              19 k
ruby-shadow          i386        1.4.1-7.el5             epel             9.5 k
Install       6 Package(s)
Upgrade       0 Package(s)
Total download size: 981 k
Is this ok [y/N]: y
[...]
  
On your puppet client















judy# yum --enablerepo="epel,epel-puppet" install puppet
[...]
Installing:
puppet            noarch   2.6.1-0.3.rc3.el5      epel-fedora   818 k
Installing for dependencies:
facter            noarch   1.5.8-0.2.rc2.el5      epel-fedora    55 k
libselinux-ruby   i386     1.33.4-5.5.el5         base           60 k
ruby-augeas       i386     0.3.0-1.el5            epel           19 k
ruby-shadow       i386     1.4.1-7.el5            epel          9.5 k
Install       5 Package(s)
Upgrade       0 Package(s)
Total download size: 961 k
Is this ok [y/N]: y
  
  That’s it, in part 2 and 3 we will install our client and server and install dashboard.
  
  

Part 2: Puppet 2.6.1, configure puppetmaster and puppetd

Configure Puppetmaster
  For installing puppetmaster 2.4.1 on CentOS please click here for Part 1

In Part 1 we covered installing the Puppetmaster and Puppetd packages on Centos 5.5. We will now configure a very basic client/server model to serve the /etc/resolv.conf file to our client. Simple enough!
  

Create your first module
  Our first module will be called networking::resolver, it’s job will be to push out a resolve.conf file to clients.

Create the directory structure under /etc/puppet















punch# cd /etc/puppet
punch# mkdir modules
punch# mkdir modules/networking
punch# mkdir modules/networking/files
punch# mkdir modules/networking/manifests
punch# mkdir files
  
  Create your resolv.conf file















punch# vi modules/networking/files/resolv.conf
  Create your module manifest















punch# vi modules/networking/manifests/init.pp
















class networking {
# Here you can add stuff to be inhereted by your networking classes
# We won't bother for this demonstration, but just for show!
}
class networking::resolver inherits networking {
file { "/etc/resolv.conf":
ensure => present,
source => "puppet:///modules/networking/resolv.conf",
group   => "root",
owner => "root",
mode  => "0755"
}
}
  

Configure your site and nodes
  Create a minimal site.pp















punch# vi manifests/site.pp
















import "nodes"
import "templates"
filebucket { main: server => puppet }
  
Create a tempates file















punch# vi manifests/templates.pp
















class baseclass {
include networking::resolver
}
node default {
include baseclass
}
  
  Create your node file

Don’t forget to replace judy.craigdunn.org with the fqdn of your client server















punch# vi manifests/nodes.pp
















node 'basenode' {
include baseclass
}
node 'judy.craigdunn.org' inherits basenode {
}
  

Set up puppetmaster parameters
  
Create default configuration

This is a minimal puppet.conf file, a more detailed file can be produced with puppetmasterd –genconfig

The autosign will automatically sign certs for new clients, this is discouraged in a production environment but useful for testing. For information on running puppetmaster without autosign see the puppetca documentation.















punch# vi puppet.conf
















[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet
# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet
# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl
[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion.  Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig
report = true
[master]
autosign = true
  
  Set permissions for your fileserver.
Note that this allows everything, you should restrict this in a production environment.















punch# vi fileserver.conf
















[files]
path /etc/puppet/files
allow *
[modules]
allow *
[plugins]
allow *
  
  Start puppetmaster















punch# service puppetmaster start
Starting puppetmaster:                                     [  OK  ]
  


The puppet client
  
Configure puppetd
On your client, edit puppet.conf and add the following in the [agent] section, remembering to changepunch.craigdunn.org to the fqdn of your Puppetmaster.















judy# vi /etc/puppet/puppet.conf
















[agent]
server = punch.craigdunn.org
report = true
listen = true
  
  Allow puppetrunner

Create a file called namespaceauth.conf and add the following, note in a production environment this should be restricted to the fqdn of your puppet master















judy# vi /etc/puppet/namespaceauth.conf
















[puppetrunner]
allow *
  
  Start puppetd















judy# service puppet start
  
  View pending changes

Use –test along with –noop to do a dry run to view the changes that puppetd will make















judy# puppetd --noop --test
[...]
notice: /Stage[main]/Networking::Resolver/File[/etc/resolv.conf]/content: is {md5}e71a913327efa3ec8dae8c1a6df09b43, should be {md5}24b6444365e7e012e8fdc5f302b56e9c (noop)
[...]
  
Now you can run puppetd without –noop to pull in your new resolv.conf file
  
This is a very basic demonstration of creating a server/client pair with puppet. There is much more documentation on configuring and managing puppet here
  
  
  
  
  
  
  
  ################################################################
  
  
  http://my.oschina.net/duxuefeng/blog/36066



puppet安装测试


0人收藏此文章, 我要收藏发表于1年前(2011-11-28 12:06) , 已有1050次阅读 ,共0个评论

  
  puppet安装测试
  一,环境
  1,ip地址
  server端:192.168.2.129  (centos5.6  i386)
  client端:192.168.2.130  (centos5.6  i386)
  2,配置环境
  Puppet是基于Ruby写成的,安装前服务端和客户端都要准备好Ruby环境.
  配置yum源
  vim /etc/yum.repo.d/puppet.repo
  [puppetlabs]  
  name=Puppet Labs Packages  
  baseurl=http://yum.puppetlabs.com/base/  
  enabled=0  
  gpgcheck=0
  
  vim /etc/yum.repo.d/ruby.repo
  [ruby]
  name=ruby
  baseurl=http://centos.karan.org/el5/misc/testing/i386/RPMS/
  gpgcheck=0
  enabled=0
  安装ruby环境
  yum install ruby ruby-rdoc
  
  注意:安装puppet 2.6需要有ruby1.8.6的支持,以上安装的ruby为1.8.6
  
  二,安装
  1,服务器端(192.168.2.129)
  安装epel
  rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  
  安装puppet服务
  yum --enablerepo=epel,epel-puppet install puppet-server
  
  chkconfig --level 2345 puppetmaster on
  
  修改hosts,添加下面行:
  192.168.2.129    server.puppet.com   
  192.168.2.130    client.puppet.com
  
  Server端首次运行前,编辑/etc/puppet/manifests/site.pp文件,内容可以用最基本的
  [iyunv@server manifests]# vim site.pp
  
  node "client.puppet.com" {
  file {"/tmp/temp1.txt" :
  content => "hello,client."
  }
  }
  
  
  2,客户端(192.168.2.130)
  安装epel
  rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  
  安装puppet服务
  yum install puppet
  chkconfig --level 2345 puppet on
  
  修改hosts,添加下面行:
  192.168.2.129    server.puppet.com   
  192.168.2.130    client.puppet.com
  
  三,测试
  1,启动
  
  服务器端启动puppet
  [iyunv@server ~]# /etc/init.d/puppetmaster start
  
  客户端启动puppet
  [iyunv@client ~]#/etc/init.d/puppet once -v
  这时客户机会去连接服务器端,但是由于连接是在ssl上的,而服务器还没有sign过客户端的cert,客户机被断开,客户机端的服务也会被停
  
  止。
  [iyunv@client ~]# puppetd --server server.puppet.com --test
  
  客户端发出请求认证
  
  服务器端
  [iyunv@server ~]# puppetca --list
  client.puppet.com (67:BE:EA:24:79:F2:16:8F:D9:59:F4:C1:3B:8D:DC:19)
  如果出现以上信息说明服务器端和客户端连接成功,下面可以给客户机签名。
  [iyunv@server ~]# puppetca  --sign  client.puppet.com
  
  客户端
  在服务器端给客户端做完签名后,在客户端启动puppetd,可以看到客户在正常连接server。并且应用sever上为客户定制的配置策略。
  [iyunv@client ~]#/etc/init.d/puppet once -v
  
  2,测试连接
  在测试前,首先用客户端连接服务器端。
  客户端执行:
  [iyunv@client ~]# puppetd --server server.puppet.com --test
  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 client.puppet.com
  info: Certificate Request fingerprint (md5): 67:BE:EA:24:79:F2:16:8F:D9:59:F4:C1:3B:8D:DC:19
  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
  
  如果出现以下错误:
  错误1:
  [iyunv@client ~]# puppetd --server server.puppet.com --test
  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
  info: Caching certificate for client.puppet.com
  err: Could not request certificate: Retrieved certificate does not match private key; please remove certificate from server
  
  and regenerate it with the current key
  Exiting; failed to retrieve certificate and waitforcert is disabled
  解决方法:
  #puppetca --clean client.puppet.com   (服务端)  或者     #puppetca -c -a
  #/etc/init.d/puppetmaster restart  (服务端)
  #rm -rf /var/lib/puppet     (客户端)
  #/etc/init.d/puppet stop  && /etc/init.d/puppet once -v   (客户端)
  # puppetd --server server.puppet.com --test (客户端)
  #puppetca --list        (服务端)
  client.puppet.com (67:BE:EA:24:79:F2:16:8F:D9:59:F4:C1:3B:8D:DC:19)
  如果出现以上信息说明服务器端和客户端连接成功
  
  错误2:
  [iyunv@client ~]# puppetd --server server.puppet.com --test
  warning: peer certificate won't be verified in this SSL session
  info: Caching certificate for client.puppet.com
  err: Could not retrieve catalog from remote server: certificate verify failed
  warning: Not using cache on failed catalog
  err: Could not retrieve catalog; skipping run
  解决方法:
  是由于服务器端和客户端的时间不同步造成的,在客户端和服务器端执行:
  [iyunv@server ~]# /usr/sbin/ntpdate time.nist.gov
  [iyunv@client ~]# /usr/sbin/ntpdate time.nist.gov
  然后重复错误1的解决方法步骤!
  错误3:
  [iyunv@client ~]# puppetd --server server.puppet.com --test
  notice: Run of Puppet configuration client already in progress; skipping
  
  解决方法:
  出现此现象是由于/etc/puppet/manifests/site.pp配置文件没有写正确
  
  [iyunv@server ~]# cat /etc/puppet/manifests/site.pp
  node "client.puppet.com" {
  file {"/tmp/temp1.txt" :
  content => "hello,client."
  #               source => "puppet://server.puppet.com/tmp/temp1.txt"
  }
  }
  
  客户端需要再次执行:
  [iyunv@client ~]#puppetd --server server.puppet.com --verbose --waitforcert 60
  --server 告诉它master节点的ip,--waitforcert 每60秒去server端检查,--verbose 可选的输出冗余信息   
  或者   [iyunv@client ~]# puppetd --server server.puppet.com --test
  
  warning: peer certificate won't be verified in this SSL session
  info: Caching certificate for client.puppet.com
  info: Caching certificate_revocation_list for ca
  info: Caching catalog for client.puppet.com
  info: Applying configuration version '1322473855'
  info: Creating state file /var/lib/puppet/state/state.yaml
  notice: Finished catalog run in 0.03 seconds
  
  
  配置成功的标志:
  
  当申请到证书以后我们对比下这两个文件,他们的MD5值是一样的
  服务端:[iyunv@server ~]# md5sum /var/lib/puppet/ssl/ca/signed/client.puppet.com.pem
  e3152aea5e755a10a02604d51d7ab56d  /var/lib/puppet/ssl/ca/signed/client.puppet.com.pem
  客户端:[iyunv@client ~]# md5sum /var/lib/puppet/ssl/certs/client.puppet.com.pem
  e3152aea5e755a10a02604d51d7ab56d  /var/lib/puppet/ssl/certs/client.puppet.com.pem
  
  
  
  3,测试实验
  在客户端查看puppet服务是否启动,然后执行:
  [iyunv@client tmp]# puppetd --server server.puppet.com --test
  info: Caching catalog for client.puppet.com
  info: Applying configuration version '1322450970'
  notice: /Stage[main]//Node[client.puppet.com]/File[/tmp/temp1.txt]/ensure: defined content as '{md5}
  
  e105a4b8fc6a6001dc7c28526c20c0d4'
  notice: Finished catalog run in 0.04 seconds
  执行后:
  [iyunv@client ~]# cat /tmp/temp1.txt
  hello,client.
  说明配置成功
  
  
  
  
  
  [iyunv@server puppet]# /etc/init.d/puppetmaster restart
  Stopping puppetmaster: [FAILED]
  Starting puppetmaster: /usr/lib/ruby/site_ruby/1.8/puppet/network/http.rb:8:in `server_class_by_type': Mongrel is not
  
  installed on this platform (ArgumentError)
  from /usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:157:in `http_server_class_by_type'
  from /usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:137:in `http_server_class'
  from /usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:58:in `initialize'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:104:in `new'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:104:in `main'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:46:in `run_command'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:305:in `run'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:420:in `hook'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:305:in `run'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:411:in `exit_on_fail'
  from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:305:in `run'
  from /usr/sbin/puppetmasterd:4
  [FAILED]
  配置文件用默认的就不会报错
  
  关于设置主机名:
  在客户端服务器上只需修改hostname.rb,在主机名前加上mac地址,就不用修改/etc/hosts,这样可以保证主机名的唯一性。
  
  [iyunv@CDN-BJ-186 ~]# vim /usr/lib/ruby/site_ruby/1.8/facter/hostname.rb
  
  Facter.add(:hostname, :ldapname => "cn") do
  setcode do
  hostname = nil
  name = Facter::Util::Resolution.exec('/sbin/ifconfig -a |sed -n \'1p\'|awk \'{gsub(/:/,"-",$5);print $5".oss.com"}\'') or nil
  if name
  if name =~ /^([\w-]+)\.(.+)$/
  hostname = $1+"-core"
  # the Domain class uses this
  $domain = $2
  else
  hostname = name
  end
  hostname
  else
  nil
  end
  end
  end
  
  Facter.add(:hostname) do
  confine :kernel => :darwin, :kernelrelease => "R7"
  setcode do
  %x{/usr/sbin/scutil --get LocalHostName}
  end
  end
  
  
  或者
  
  Facter.add(:hostname, :ldapname => "cn") do
  setcode do
  hostname = nil
  #if name = Facter::Util::Resolution.exec('hostname')
  if name = Facter::Util::Resolution.exec("ifconfig |grep eth0|awk '{print $NF}'|head -n 1")
  if name =~ /(.*?)\./
  hostname = $1
  else
  hostname = name
  end
  end
  hostname + ".ku6-puppet.com"
  end
  end
  
  Facter.add(:hostname) do
  confine :kernel => :darwin, :kernelrelease => "R7"
  setcode do
  Facter::Util::Resolution.exec('/usr/sbin/scutil --get LocalHostName')
  end
  end
  
  客户端和服务端都只需要加上服务器域名和对应的ip
  10.10.10.2     server.puppet.com
  
  
  
  puppet常用命令
  检查manifests文件是否有语法错误
  puppet  --parseonly  manifests/site.pp
  调试代码命令
  puppet -l /tmp/site.log  /etc/puppet/manifests/site.pp
  调试代码片段
  puppet apply -e 'file {"/tmp/temp.txt":content=>"123"}'
  显示模块路径命令
  puppet  --configprint  modulepath
  显示所有设置
  puppet  --configprint  all
  
  可参考: http://www.mysqlops.com/2011/10/18/puppet-zhongwen.html
  http://www.slideshare.net/myw58/puppet-7159473
  
  
  ========================================================
  http://www.wenzizone.cn/?p=417
  centos是目前使用最广泛的linux服务器系统之一,其使用yum对软件包管理的方便性,更是每个用centos的人喜欢的。蚊子我现在也越来越喜欢用yum来安装软件包了,除非特殊需要,已经很少编译安装软件了。
  在加上centos的扩展源(repo)也很多,比如众所周知的EPEL,还有蚊子之前《yum源分享》文章中介绍的两个。
  但说到centos使用yum装puppet就不那么容易了,首先epel中倒是提供了puppet的安装包,但提供仅仅是2.6.6的版本,fedora的提供了另外的一个puppet源,http://tmz.fedorapeople.org/repo/puppet/epel/puppet.repo,在这个源中,puppet的版本有所提高,但也仅仅是2.6.11而已。
  如今,puppet开源版最新已经达到了2.7.5,想要使用源码安装的朋友可以到这里下载。可眼下我们选择了centos,当然要使用最简单的yum或者rpm来安装。puppetlabs还算仗义,也提供了rpm包。地址是http://yum.puppetlabs.com/,这个网址中不仅提供了EL的包,还有fedora的包,使用者可以根据自己的需要进行选择。
  在EL的目录下提供了版本5和版本6的所有32位和64位的包,使用者可以下载安装自己系统架构目录下puppetlabs-release-X-1.noarch.rpm文件来安装(注:其中文件中的大写X表示对应的版本号,5或6),安装完毕之后会自动创建repo文件,接下来要做的就是使用yum进行安装就可以了。所安装的就是puppet最新的2.7.5版本。
  这里建议系统中添加epel源,以防止centos自带源软件包过少,关联包安装不上,导致安装失败。


View Code TXT





Name       : puppet
Arch       : noarch
Version    : 2.7.5
Release    : 1.el5
Size       : 2.8 M
Repo       : installed
Summary    : A network tool for managing many disparate systems
URL        : http://puppetlabs.com
License    : ASL 2.0
Description: Puppet lets you centrally manage every important aspect of your system using a
: cross-platform specification language that manages all the separate elements
: normally aggregated in different files, like users, cron jobs, and hosts,
: along with obviously discrete elements like packages, services, and files.
  蚊子根据安装好的repo文件,自己修改了一版,修改后的repo文件可以自动分辨当前系统版本号和架构,省的再去安装那个rpm包了


Download puppetlabs.repo





[puppetlabs-products]
name=Puppet Labs Products $releasever - $basearch
baseurl=http://yum.puppetlabs.com/el/$releasever/products/$basearch
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
[puppetlabs-deps]
name=Puppet Labs Dependencies $releasever - $basearch
baseurl=http://yum.puppetlabs.com/el/$releasever/dependencies/$basearch
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
[puppetlabs-products-source]
name=Puppet Labs Products $releasever - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/$releasever/products/SRPMS
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
failovermethod=priority
enabled=0
gpgcheck=1
[puppetlabs-deps-source]
name=Puppet Labs Source Dependencies $releasever - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/$releasever/dependencies/SRPMS
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
  也希望更多的人来测试这个repo内容是否正确,蚊子这边的系统环境是centos5.6,x86架构,安装一切正常。
  
  
  
  http://www.net527.cn/a/caozuoxitong/Linux/2012/1215/25186.html
  
  Centos 5 使用yum源安装puppet 2.6
  一,配置yum源
cd /etc/yum.repos.d/
  vim puppet.repo

[puppetlabs] name=Puppet Labs Packages baseurl=http://yum.puppetlabs.com/base/ enabled=0 gpgcheck=0
  vim epel.repo

[epel]
name=Extra Packages for Enterprise Linux 5 -$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=0
[epel-puppet]
name=epel puppet
baseurl=http://tmz.fedorapeople.org/repo/puppet/epel/5/$basearch/
enabled=0
gpgcheck=0
  编码 问题会有一个乱码:mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
  vim ruby.repo

name=ruby baseurl=http://repo.premiumhelp.eu/ruby/ gpgcheck=0 enabled=0
  puppet 2.6 需要 ruby 1.8.6 去运行 puppet-dashboard
升级ruby

# yum --enablerepo="ruby" update ruby 如果你没有安装ruby 请使用: #yum -y install ruby
  安装 Puppet Server
Server端:On your puppetmaster server:

# yum --enablerepo=epel,epel-puppet install puppet-server
  Client 端:On your puppet client

# yum --enablerepo="epel,epel-puppet" install puppet
  Server端配置site.pp
vim /etc/puppet/site.pp
node default {
file { “/tmp/temp1.txt”: content => “hello,first puppet manifest”; }
}
  Client端配置hostsname
echo ‘client.example.com’ > /etc/hostname
hostname -F /etc/hostname
Client端运行:

puppetd --server master.example.com --test
  上面的命令让puppetd 从 master.example.com 去读取puppet配置文件. 第一次连接,双方会进行ssl证书的验证,这是一个新的客户端,在服务器端那里还没有被认证,因此需要在服务器端进行证书认证.
在服务器端的机器上执行下面的命令来认证客户端的证书
  Server端:

puppetca -s client.example.com
  然后再重新在客户端执行

puppetd --server master.example.com --test
  配置完成。

运维网声明 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-114462-1-1.html 上篇帖子: 下篇帖子: CentOS 6.3安装Puppet3.x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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