Puppet客户端自动安装脚本(2)

tail -1 /etc/sysconfig/puppetmaster |grep "mongrel";[ $? -ne 0 ]&& echo -e "PUPPETMASTER_PORTS=( 18140 18141 18142 18143 18144 )\nPUPPETMASTER_EXTRA_OPTS=\"-servertype=mongrel --ssl_client_header=HTTP_X_SSL_SUBJECT\"" >>/etc/sysconfig/puppetmaster

#配置puppet master 、Hosts

grep $PUPPET_SERVER /etc/hosts ;[ $? -ne 0 ] &&echo "`echo $PUPPET_SERVER|awk -F- '{print $1"."$2"."$3"."$4}'` $PUPPET_SERVER" >>/etc/hosts

echo +++++++++++++++++++++++++++++++++++++++++++++++++++++

echo

ETH=`ifconfig |grep Bcast|cut -d: -f 2|awk '{print $1}'`

echo "Please insert PUPPET_SERVER /etc/hosts :: $ETH `echo $ETH|sed 's/\./-/g'`-app.com"

cat /etc/hosts |grep -v 127 |grep $ETH ;[ $? -ne 0 ] && echo "$ETH `echo $ETH|sed 's/\./-/g'`-app.com" >>/etc/hosts

HOSTNAME=`echo $ETH|sed 's/\./-/g'`-app.com

hostname $HOSTNAME

cat /etc/hosts|grep 127.0.0.1|grep $HOSTNAME ;[ $? -ne 0 ] &&sed -i "s/127.0.0.1/127.0.0.1 $HOSTNAME/" /etc/hosts

cd ../ ;rm -rf facter-1.6.8

}

#如下case条件语句可以选用,这里仅供参考,真实安装去掉函数定义和case方式即可。

###config caseselect

#$1表示第一个参数

case $1 in

client )

client

;;

server )

server

;;

* )

echo "Please exec $0 { client or server }"

;;

esac

此脚本仅供参��,欢迎大家多交流!

Puppet 的详细介绍请点这里
Puppet 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/fdb816fb41857f4ed87f43ebe978b1e4.html