-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.tpl
104 lines (101 loc) · 2.65 KB
/
init.tpl
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
set -exuo pipefail
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
mkdir /etc/ansible-provision;
cat >/etc/profile.d/env.sh <<'EOL'
export strategy=${strategy}
alias 0='cat /etc/login.warn'
alias 1='sudo journalctl -u google-startup-scripts.service -f'
case $strategy in
crc)
alias 2='sudo tail -f /var/log/messages -n +1 | grep runuser'
alias 3='su - crcuser'
;;
snc)
alias 2='while [ ! -f /home/crcuser/snc/install.out ]
do
sleep 2
done
sudo tail -f /home/crcuser/snc/install.out'
alias 3='su - crcuser'
;;
mnc)
alias 2='while [ ! -f /root/ansible.install.out ]
do
sleep 2
done
sudo tail -f /root/ansible.install.out'
alias 21='while [ ! -f /root/ocp/install/.openshift_install.log ]
do
sleep 2
done
sudo tail -f /root/ocp/install/.openshift_install.log'
alias 3='su -';
;;
*)
alias 2='echo please review /etc/profile.d/env.sh'
;;
esac
EOL
function fail {
echo $1 >&2
exit 1
}
function retry {
local n=1
local max=5
local delay=15
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
sleep $delay;
else
fail "The command has failed after $n attempts."
fi
}
done
}
cat >/etc/login.warn <<EOL
${file_banner}
EOL
cat >/etc/motd <<EOL
${file_banner}
EOL
pip3 install --upgrade pip
pip3 install ipaddr
pip3 install netaddr
echo "setting metadata_timer_sync=0" >> /etc/dnf/dnf.conf
systemctl stop dnf-makecache.timer
systemctl disable dnf-makecache.timer
systemctl stop dnf-automatic.timer
systemctl disable dnf-automatic.timer
cd /etc/ansible-provision;
pip3 install gdown
gdown --id 1F-2HzXPdKXnhDKkxnFLZmVyuXTRjv2EB
gdown --id 12nmicIMrZBtk7EPFl_RcIG_Votn-YUI2
tar -xf ansible29.tar.gz
ps aux | grep "automatic.conf --timer"
kill $(ps aux | grep 'automatic.conf --timer' | awk '{print $2}') || true
retry dnf install *.rpm -y
cat >/tmp/inadyn.conf <<'EOL'
${file_inadyn_conf}
EOL
cat >/tmp/ddns.j2 <<'EOL'
${file_ddns_j2}
EOL
cat >/tmp/crc.j2 <<'EOL'
${file_crc_j2}
EOL
cat >/tmp/tools.sh <<'EOL'
${file_tools_sh}
EOL
echo "${file_provision_yml}" | base64 -d > /tmp/provision.yml
cp -a /tmp/inadyn.conf .
cp -a /tmp/ddns.j2 .
cp -a /tmp/crc.j2 .
cp -a /tmp/provision.yml .
ansible-playbook provision.yml
#to check ansible logs:
#sudo journalctl -u google-startup-scripts.service -f