-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpre-configuration-openstack.sh
More file actions
125 lines (88 loc) · 2.64 KB
/
pre-configuration-openstack.sh
File metadata and controls
125 lines (88 loc) · 2.64 KB
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
#!/bin/bash
bgreen='\033[1;32m'
red='\033[0;31m'
nc='\033[0m'
bold="\033[1m"
blink="\033[5m"
echo
echo
echo -e "${bgreen}Step-01: Install OpenStack-PackStack on Almalinux 9 ${nc} "
hostnamectl
timedatectl
timedatectl set-timezone Asia/Dhaka
# Set Hostname
#echo -e "${bgreen}Setup System Hostname : ${nc}"
echo
echo
read -p "$(echo -e "${bgreen}${bold}${blink}Type System Hostname: ${nc}")" hostname
read -p "$(echo -e "${bgreen}${bold}${blink}Type Your Domain (Like: paulco.xyz): ${nc}")" mydomain
hostnamectl set-hostname $hostname
echo -e "${bgreen} Enable PowerTools/CRB repository ${nc} "
#dnf install dnf-plugins-core -y
dnf config-manager --set-enabled crb -y
dnf install epel-release -y
dnf install nano -y
dnf install screen -y
dnf install wget -y
#sudo dnf install https://www.rdoproject.org/repos/rdo-release.el9.rpm -y
#dnf install centos-release-openstack-antelope -y
#dnf install centos-release-openstack-zed -y
#dnf install centos-release-openstack-bobcat -y
dnf install centos-release-openstack-yoga -y
dnf clean all
#dnf clean all
#dnf update -y
dnf install network-scripts -y
ls /etc/sysconfig/network-scripts/
#systemctl status network
systemctl start network
systemctl enable network
# Verifying IP & MAC Addresses
ip a
echo
echo
echo -e "${bgreen}${bold}${blink} Configure Static IP ${nc} "
read -p "Type static IP Interface Name: " STATIC_INTERFACE
read -p "Type MAC for static Interface: " MAC_ADDRESS
read -p "Type static IP Address: " IP_ADDRESS
read -p "Type IP PREFIX (CIDR): " IP_PREFIX
read -p "Type Gateway4: " GATEWAY
read -p "Type 1st DNS: " DNS
read -p "Type 2nd DNS: " DNS2
cat <<EOF | sudo tee /etc/sysconfig/network-scripts/ifcfg-$STATIC_INTERFACE
HWADRR=$MAC_ADDRESS
NM_CONTROLLED=no
BOOTPROTO=static
ONBOOT=yes
IPADDR=$IP_ADDRESS
PREFIX=$IP_PREFIX
GATEWAY=$GATEWAY
DNS1=$DNS
DNS2=$DNS2
DEVICE=$STATIC_INTERFACE
EOF
# Apply the Netplan configuration
nmcli connection up $STATIC_INTERFACE
ip a s $STATIC_INTERFACE
systemctl restart NetworkManager
ifup $STATIC_INTERFACE
cp /etc/sysconfig/network-scripts/ifcfg-$STATIC_INTERFACE /etc/sysconfig/network-scripts/ifcfg-$STATIC_INTERFACE.bak
cat /etc/sysconfig/network-scripts/ifcfg-$STATIC_INTERFACE
echo "$IP_ADDRESS $hostname.$mydomain $hostname" >> /etc/hosts
echo
echo
hostname -f
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
systemctl disable firewalld
systemctl stop firewalld
#systemctl status NetworkManager
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl restart network
ifup $STATIC_INTERFACE
#dnf autoremove epel-release -y
#dnf autoremove openstack-packstack -y
#dnf clean all
dnf repolist
dnf update -y && dnf upgrade -y
reboot