集中式系统管理 Puppet安装配置使用,puppet安装配置Puppet的简单陈


Puppet,您可以集中管理每一个重要方面,您的系统使用的是跨平台的规范语言,管理所有的单独的元素通常聚集在不同的文件,如用户, CRON作业,和主机一起显然离散元素,如包装,服务和文件。

Puppet的简单陈述规范语言的能力提供了强大的classing制定了主机之间的相似之处,同时使他们能够提供尽可能具体的必要的,它依赖的先决条件和对象之间的关系清楚和明确。

记得以前看过,貌似感觉cfengin比较好,不过既然老外那边已经用了这个,那花些时间再看看熟熟手。

vi /etc/hosts
192.168.0.10 puppetserver
192.168.0.11 puppetclient1
 
yum -y install ruby ruby-libs ruby-rdoc
wget http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm
yum install puppetlabs-release-6-7.noarch.rpm
[server] yum -y install puppet-server
[server] service puppetmaster start
 
[client] yum -y install puppet
[client] puppet agent --no-daemonize --onetime --verbose --debug --server=puppetserver
 
[server] puppet cert list --all #会看到一个前面没有+号的client key
[server] puppet cert --sign puppetclient1 #确认client的key

在puppetclient1上新建一个helloworld.txt文件

[server] vi /etc/puppet/manifests/site.pp
node default {
  file {
    "/tmp/helloworld.txt": content => "hello, world";
  }
}
[client] puppet agent --test --server=puppetserver

在puppetclient1上安装tree

[server] vi /etc/puppet/manifests/site.pp
import 'nodes.pp'
[server] vi /etc/puppet/manifests/nodes.pp
node 'puppetclient1' {
      include tree
}
[server] vi /etc/puppet/puppet.conf
modulepath=/etc/puppet/modules:/var/lib/puppet/modules:/opt/modules
[server] mkdir -p /etc/puppet/modules/tree/{files,manifests,templates}
[server] vi /etc/puppet/modules/tree/manifests/init.pp
class tree {
  package { tree:
    ensure => present,
  }
  #类型 { 标题:
  #  属性 => 值,
  #  }
  #}
}
[client] puppet agent --no-daemonize --verbose --debug --server=puppetserver

安装Dashboard

[server] yum -y install puppet-dashboard
mysql> create database dashboard default charset utf8;
mysql> use dashboard;
mysql> grant all on dashboard.* to dashboard@localhost identified by 'dashboard' ; 
mysql> flush privileges;
[server] vi /usr/share/puppet-dashboard/config/database.yml
production:
  database: dashboard
  username: dashboard
  password: dashboard
  encoding: utf8
  adapter: mysql
  #用ruby的rake命令创建数据库和创建表
[server] cd /usr/share/puppet-dashboard/
[server] rake RAILS_ENV=production db:create
[server] rake RAILS_ENV=production db:migrate
 
#运行puppet-dashboard
[server] /usr/share/puppet-dashboard/script/server -e production
#或是
[server] /etc/init.d/puppet-dashboard start
#这样将用3000端口运行自带的webrick服务器。

相关内容