vm1為master hostname為vm1.example.com
創(chuàng)新互聯(lián)主營(yíng)貢井網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都app開發(fā),貢井h5微信小程序搭建,貢井網(wǎng)站營(yíng)銷推廣歡迎貢井等地區(qū)企業(yè)咨詢vm2 vm3 vm4為client,hostname為vm2|vm3|vm4.example.com
腳本如下:
- #!/bin/bash
- PROG_NAME=$0
- vm=$1
- usage() {
- echo "Usage: $PROG_NAME {vm1|vm2|vm3|vm4|reca}"
- exit 1;
- }
- if [ $# -ne 1 ]; then
- usage
- fi
- prepare()
- {
- echo "alias vivim=vi">> ~/.bash_profile
- service iptables stop
- cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- /usr/sbin/ntpdate time.nist.gov
- echo "*/5 * * * * /usr/sbin/ntpdate time.nist.gov" > /var/spool/cron/root
- chmod 600 /var/spool/cron/root
- }
- install_master()
- {
- sed -i "s/HOSTNAME=.*/HOSTNAME=${vm}.example.com/" /etc/sysconfig/network
- hostname $vm.example.com
- echo "10.13.114.3 vm1.example.com" >> /etc/hosts
- echo "10.13.114.25 vm2.example.com" >> /etc/hosts
- echo "10.13.114.27 vm3.example.com" >> /etc/hosts
- echo "10.13.114.30 vm4.example.com" >> /etc/hosts
- #####step 1.install ruby environment#####
- wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
- yum -y install ruby ruby-rdoc
- #####step 2.install puppet server#######
- rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-4.noarch.rpm
- yum -y install puppet-server
- chkconfig --level 2345 puppetmaster on
- cat >> /etc/puppet/manifests/site.pp << EOF
- node default {
- file { "/tmp/temp1.txt": content => "hello,first puppet manifest"; }
- }
- EOF
- cat >>/etc/puppet/autosign.conf <<EOF
- *.example.com
- EOF
- }
- install_client()
- {
- sed -i "s/HOSTNAME=.*/HOSTNAME=${vm}.example.com/" /etc/sysconfig/network
- hostname $vm.example.com
- echo "10.13.114.3 vm1.example.com" >> /etc/hosts
- echo "10.13.114.25 vm2.example.com" >> /etc/hosts
- echo "10.13.114.27 vm3.example.com" >> /etc/hosts
- echo "10.13.114.30 vm4.example.com" >> /etc/hosts
- #####step 1.install ruby environment#####
- wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
- yum -y install ruby ruby-rdoc
- ####step 2.install puppet server####
- rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-4.noarch.rpm
- yum -y install puppet
- chkconfig --level 2345 puppet on
- echo " server=vm1.example.com">>/etc/puppet/puppet.conf
- echo " listen=true">>/etc/puppet/puppet.conf
- cat >>/etc/puppet/namespaceauth.conf << EOF
- [fileserver]
- allow *
- [puppetmaster]
- allow *
- [puppetrunner]
- allow *
- [puppetbucket]
- allow *
- [puppetreports]
- allow *
- [resource]
- allow *
- EOF
- }
- re_create_ca()
- {
- rm -f /var/lib/puppet/ssl/certs/*
- rm -f /var/lib/puppet/ssl/certificate_requests/*
- rm -f /var/lib/puppet/ssl/crl.pem
- }
- case "$vm" in
- vm1)
- prepare
- install_master
- ;;
- vm2)
- prepare
- install_client
- ;;
- vm3)
- prepare
- install_client
- ;;
- vm4)
- prepare
- install_client
- ;;
- reca)
- re_create_ca
- ;;
- *)
- usage
- ;;
- esac
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開啟,新人活動(dòng)云服務(wù)器買多久送多久。
文章標(biāo)題:自動(dòng)安裝puppet腳本-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://muchs.cn/article6/phsog.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、定制網(wǎng)站、電子商務(wù)、微信小程序、關(guān)鍵詞優(yōu)化、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)