1、目标
初始每台服务器安装,首先要安装puppet,然后再通过puppet进行配置和部署,那么首次安装puppet,需要把puppet和facter的源码打包进shell脚本并通过运行该脚本自动进行安装,这里介绍一个自解压后自动运行的安装puppet的脚本。
2、脚本说明
首先从脚本可执行命令后解压出puppet和facter的gz包;
然后运行常规的facter和puppet的安装过程;
配置puppet从puppetmaster获取配置并进行首次常规配置
3、脚本内容 puppet.sh
自解压安装puppet的脚本文件
#!/bin/bash
# Auto install puppet
# Extract
sed '1,/^#__END__$/d' $0 | tar zxvf -
# Conf,install factor puppet
# install ruby first
yum install ruby -y
# facter
tar xvfz facter-1.7.2.tar.gz
cd facter-1.7.2
./install.rb
cd ../
# puppet
tar xvfz puppet-2.7.23.tar.gz
cd puppet-2.7.23
./install.rb
# puppet config
cp conf/redhat/puppet.conf /etc/puppet/
groupadd puppet ;useradd puppet -g puppet
cp /etc/hosts /etc/hosts.`date`
echo "192.168.10.105 master.&&&.mobi" >> /etc/hosts
#first get config from puppet maseter
puppetd --test --server master.&&&.mobi
exit
#__END__
4、制作过程
首先将puppet.sh保存;
将puppet和facter的源码gz包,tar成一个1.gz
tar xvfz facter-1.7.3.tar.gz
tar xvfz puppet-2.7.23.tar.gz
tar cvfz 1.gz facter-1.7.3 puppet-2.7.23
cat 1.gz >>puppet.sh
5、运行命令
sh puppet.sh 或者 chmod +x puppet.sh ;./puppet.sh
阅读(2874) | 评论(0) | 转发(0) |