forked from gleventhal/SysAdmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_epel_and_puppet.sh
36 lines (31 loc) · 1.04 KB
/
add_epel_and_puppet.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
[[ -z "$1" ]] && puppetmaster='default_puppetmaster' || puppetmaster="$1"
epel=$(yum repolist|egrep -q '^epel')$?
mailto=puppet_admin@foo.bar
function install_epel()
{
echo "Installing EPEL Repo and Puppet client"
if [[ $(lsb_release -d) =~ 'Red Hat Enterprise Linux Server release 5' ]]; then
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5*.rpm
elif [[ $(lsb_release -d) =~ 'Red Hat Enterprise Linux Server release 6' ]]; then
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6*.rpm
else
echo "This is not RHEL 5 or 6; Exiting.."
exit 1
fi
}
function config_puppet()
{
yum -y install puppet
chkconfig puppet on
sed -i "12 a\ server = $puppetmaster" /etc/puppet/puppet.conf
echo signme|mail -s "$(hostname) is waiting to be signed on puppet master" $mailto
puppet agent --test --waitforcert 5
service puppet start
}
if ! [[ $epel -eq 0 ]]; then
install_epel
fi
config_puppet