-
Notifications
You must be signed in to change notification settings - Fork 0
/
next-step1.sh
48 lines (38 loc) · 1.84 KB
/
next-step1.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
#!/bin/bash
# Setting UP passwordless login from DNS server
for node in {ose-master,ose-hub,ose-node1,ose-node2}; do
echo "Deploy SSH Key on $node" && \
scp -i prasen.pem /root/.ssh/id_rsa.pub ec2-user@$node:/home/ec2-user/.ssh/id_rsa.pub_root
ssh ec2-user@$node -i prasen.pem "sudo mv /home/ec2-user/.ssh/id_rsa.pub_root /root/.ssh/authorized_keys"
ssh ec2-user@$node -i prasen.pem "sudo chown root:root /root/.ssh/authorized_keys"
ssh ec2-user@$node -i prasen.pem "sudo chmod 600 /root/.ssh/authorized_keys"
ssh ec2-user@$node -i prasen.pem "sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config"
ssh ec2-user@$node -i prasen.pem "sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
ssh ec2-user@$node -i prasen.pem "sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config"
ssh ec2-user@$node -i prasen.pem "sudo service sshd restart"
done
# Rebooting servers
for node in {ose-master,ose-hub,ose-node1,ose-node2}; do
echo "Rebooting $node" && \
ssh $node reboot
done
echo "Waiting for servers up ...."
sleep 120
# Configuring Repo and setting network
for node in {ose-master,ose-hub,ose-node1,ose-node2}; do
echo "Deploy Openshift Repo on $node" && \
scp /etc/yum.repos.d/open.repo $node:/etc/yum.repos.d/open.repo
ssh $node "echo 'nameserver 8.8.8.8' | sudo tee --append /etc/resolv.conf"
ssh $node "echo 'preserve_hostname: true' | sudo tee --append /etc/cloud/cloud.cfg"
ssh $node "rm /etc/hostname"
ssh $node "touch /etc/hostname"
ssh $node "echo '$node.cloud-cafe.in' | sudo tee --append /etc/hostname"
ssh $node "echo 'HOSTNAME=$node.cloud-cafe.in' | sudo tee --append /etc/sysconfig/network"
done
# Rebooting servers
for node in {ose-master,ose-hub,ose-node1,ose-node2}; do
echo "Rebooting $node" && \
ssh $node reboot
done
echo "Waiting for servers up ...."
sleep 90