-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsatellite-configure.sh
147 lines (117 loc) · 3.28 KB
/
satellite-configure.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
echo "==========================================================================================="
echo "Initiating Satellite 6.2 system registration and configuration setup..[Internal use only]"
echo "===========================================================================================
"
trap ctrl_c INT
function ctrl_c() {
echo "**Trapped CTRL-C**" ; exit
}
#System information.
echo "System Information:"
echo "########################################"
echo "Hostname:"
hostname
echo "########################################"
cat '/etc/redhat-release'
echo "########################################"
echo "Memory Info:"
free -m
echo "########################################"
echo "Disk Info:"
df -h
echo "########################################"
echo "Date:"
date
echo "########################################"
echo "
"
#Installer details.
echo "Please provide Satellite Installer details"
echo "Organization Name:"
unset org
while [ -z ${org} ]; do
read org
done
echo "Location Name:"
unset loc
while [ -z ${loc} ]; do
read loc
done
echo "Admin Username:"
unset username
while [ -z ${username} ]; do
read username
done
echo "Admin Password:"
unset passwd
while [ -z ${passwd} ]; do
read passwd
done
read -p "Do you wish to install Satellite with above parameters. STOP the installer if 'DNS' is not configured properly. Y/N: " -n 1 -r
echo "
"
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
echo "
"
#Registration.
echo "Registering system to the RHSM, Red Hat portal credentials required"
subscription-manager register --force
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Registration Successful!"
else
echo "Registration Failed :("
exit 1
fi
echo "
"
#Subscription.
echo "Attaching Employee Satellite subscription"
sub=`subscription-manager list --matches="Red Hat Satellite Employee Subscription" --all --available | grep "Pool ID:" | awk '{print $3}'`
subscription-manager attach --pool="$sub"
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Satellite Subsription Attached!"
else
echo "Failed to attach Subscription :("
exit 1
fi
echo "
"
#Enable repos.
echo "Enabling required repositories..."
subscription-manager repos --disable "*" --enable=rhel-7-server-rpms --enable=rhel-server-rhscl-7-rpms --enable=rhel-7-server-satellite-6.2-rpms
#Update the system.
yum clean all
yum update -y
echo "
"
#Install the Satellite server.
echo "Insatlling Satellite server..."
yum install satellite -y
echo "
"
#Configure the Satellite server.
echo "******************************************"
echo "Executing Installer with below parameters"
echo "------------------------------------------"
echo "Org:$org"
echo "------------------------------------------"
echo "Location:$loc"
echo "------------------------------------------"
echo "User:$username Password:$passwd"
echo "******************************************"
echo "
"
satellite-installer --scenario satellite --foreman-initial-organization "$org" --foreman-initial-location "$loc" --foreman-admin-username "$username" --foreman-admin-password "$passwd" --foreman-proxy-dns-managed=false --foreman-proxy-dhcp-managed=false
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Yippee! Configuration Completed :)"
else
echo "Installation Failed :( "
exit 1
fi