Chinaunix首页 | 论坛 | 博客
  • 博客访问: 270784
  • 博文数量: 53
  • 博客积分: 2580
  • 博客等级: 少校
  • 技术积分: 509
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-29 10:02
文章分类

全部博文(53)

文章存档

2014年(1)

2013年(1)

2011年(14)

2010年(37)

我的朋友

分类: LINUX

2010-07-30 16:48:00

服务器端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

[puppetmasterd]
    # 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
    user = root
    group = root
    fileserverconfig = /etc/puppet/fileserver.conf
    reportdir = /home/logs/puppet/reports
    reports = store
    masterhttplog = /home/logs/puppet/masterhttp.log

客户端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

[puppetd]
    # 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
    railslog = /var/log/puppet/rails.log
    ca_port = 8140
    puppetdlockfile = /var/lib/puppet/state/puppetdlock
    listen = false
    ignorecache = false
    server = beijing31.sys.puppet.pplive
    classfile = /var/lib/puppet/classes.txt
    pidfile = /var/run/puppet/puppetd.pid
    reportserver = beijing31.sys.puppet.pplive
    puppetdlog = /var/log/puppet/puppetd.log
    ca_server = beijing31.sys.puppet.pplive
    runinterval = 1200
    report = true
    config = /etc/puppet/puppet.conf
    report_server = beijing31.sys.puppet.pplive
    confdir = /etc/puppet
    logdir = /var/log/puppet
    modulepath = /etc/puppet/modules:/usr/share/puppet/modules


客户端安装脚本init-puppet.sh

#!/bin/bash

#init-puppet.sh

#version 1.0

#update 20100721 BY Serwei Xu(serweixu@pplive.com)

#Author: Serwei Xu(xw2014@sina.com)

sysdate=`date +'%F'`
server_version=`uname -i`

check_dependence( )
{
   if [ "`rpm -qa |grep $1|wc -l`" -lt 1 ];then
         echo "The system have no $1,please check it! "
        exit 0
   else
         echo "check dependence for $1"
   fi
}

check_evn( )
{
   #check who running the script 
   echo
   echo "#######################check who running the script############################"
   echo
    if [ "`whoami`" != "root" ];then
        echo
        echo "###################the shell script will running by root#####################"
        echo
        exit 0
    fi 

    #install dependence rpm

    echo
    echo "############################install dependence rpm#######################"
    echo
    yum -y install mysql
    yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
    yum -y install gcc gcc-c++ autoconf automake
    yum -y install perl perl-URI perl-DBI perl-String newt-perl
    #check dependence

    echo
    echo "###############################check dependence#########################"
    echo
    check_dependence zlib
    check_dependence zlib-devel
    check_dependence openssl
    check_dependence openssl-devel
    check_dependence pcre
    check_dependence pcre-devel
    check_dependence gcc
    check_dependence gcc-c++
    check_dependence autoconf
    check_dependence automake
    check_dependence mysql
    check_dependence perl
}

##############################################

#install puppet

##############################################

install_puppet()
{
echo "nameserver 8.8.8.8" >>/etc/resolv.conf
if [ "`uname -i`" == "i386" ];then
      rpm -Uvh http://mirrors.sohu.com/fedora-epel/5/i386/epel-release-5-3.noarch.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/i386/CentOS/libselinux-1.33.4-5.5.el5.i386.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/i386/CentOS/libselinux-devel-1.33.4-5.5.el5.i386.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/i386/CentOS/libselinux-python-1.33.4-5.5.el5.i386.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/i386/CentOS/libselinux-ruby-1.33.4-5.5.el5.i386.rpm
      rpm -Uvh /tmp/libselinux* --aid
      yum -y install puppet
      rm -f /tmp/libselinux*
elif [ "`uname -i`" == "x86_64" ];then
      rpm -Uvh http://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-3.noarch.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-1.33.4-5.5.el5.i386.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-1.33.4-5.5.el5.x86_64.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-devel-1.33.4-5.5.el5.i386.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-devel-1.33.4-5.5.el5.x86_64.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-python-1.33.4-5.5.el5.x86_64.rpm
      wget -P /tmp http://mirrors.sohu.com/centos/5.4/os/x86_64/CentOS/libselinux-ruby-1.33.4-5.5.el5.x86_64.rpm
      rpm -Uvh /tmp/libselinux* --aid
      yum -y install puppet
      rm -f /tmp/libselinux*
fi
chkconfig --level 345 puppet on
}


####################################################

#install puppet conf

####################################################

install_puppet_conf( )
{
     echo 'init puppet conf start'
     [ -f /etc/puppet/puppet.conf ]&& mv /etc/puppet/puppet.conf /etc/puppet/puppet.conf.$sysdate
     wget -P /etc/puppet -c
}
sysconfig()

{

host=`grep HOSTNAME /etc/sysconfig/network|awk -F = '{print$2}'`
name=test123-`ifconfig eth0|grep 'inet addr'|awk '{print$2}'|awk -F . '{print$4}'`.ppvod.pplive
hostname $name
sed -e "/HOSTNAME/s/$host/$name/" -i /etc/sysconfig/network

echo "192.168.2.4 beijing31.sys.puppet.pplive" >>/etc/hosts

}

check_evn

sysconfig
install_puppet
install_puppet_conf
puppetd --test


阅读(2044) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~