debian一键安装saltstack
#!/bin/bash###########################IPADDRESS##############################
IP=`ifconfig eth0| grep 'inet addr:' | sed 's/^.*addr://g' | sed 's/Bcast.*$//g' | awk -F '.' '{print $1}'`
if[ "$IP"-eq "10" ];then
LAN_IP=`ifconfig eth0| grep 'inet addr:' | sed 's/^.*addr://g' | sed 's/Bcast.*$//g'`
#echo $LAN_IP
else
LAN_IP=`ifconfig eth1| grep 'inet addr:' | sed 's/^.*addr://g' | sed 's/Bcast.*$//g'`
#echo $LAN_IP
fi
##########################centos install salt-minoin##################
#cat /etc/issue| grep -q '6.*'&& rpm-Uvh http://mirror.pnl.gov/epel/6/x86_64/epel-release-6-8.noarch.rpm|| rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
#cat /etc/issue| grep -q '5.*'&& rpm -Uvh http://mirror.pnl.gov/epel/5/i386/epel-release-5-4.noarch.rpm || rpm –ivhhttp://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm
#yum-y install salt-minion
##########################debianinstall salt-minion##################
echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> /etc/apt/sources.list&& apt-get update
wget -q -O- "http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key" | apt-key add -
apt-get install -y salt-minion
sed -i "s/#master: salt/master: 10.2.0.46/g"/etc/salt/minion
sed -i "s/#id:/id: $LAN_IP/g" /etc/salt/minion
/etc/init.d/salt-minion start
cat /etc/rc.local | grep salt-minion || echo "/etc/init.d/salt-minion start" >> /etc/rc.local
cat /var/spool/cron/root | grep salt-minion || echo "00 01 * * */etc/init.d/salt-minion restart" >> /var/spool/cron/root
rm -f /usr/local/src/salt-minion_install.sh
页:
[1]