3
3
# Reset SECONDS
4
4
SECONDS=0
5
5
6
- # Cloud User: cloud-user (CentOS) or ubuntu?
7
- CLOUD_USER=cloud-user
8
-
9
6
ENABLE_OVN=true
10
7
11
8
# Registry IP
@@ -14,19 +11,20 @@ registry_ip=$1
14
11
echo " [INFO] Given docker registry IP: $registry_ip "
15
12
16
13
# Disable the firewall.
17
- if [[ " ${CLOUD_USER} " = " ubuntu " ]]
18
- then
14
+ if type apt ; then
15
+ grep -q $HOSTNAME /etc/hosts || (echo " $( ip r | grep -o ' ^default via.*src [0-9.]* ' | awk ' {print $NF} ' ) $HOSTNAME " | sudo tee -a /etc/hosts)
19
16
dpkg -l ufw && sudo systemctl is-enabled ufw && sudo systemctl stop ufw && sudo systemctl disable ufw
20
17
else
21
18
rpm -q firewalld && sudo systemctl is-enabled firewalld && sudo systemctl stop firewalld && sudo systemctl disable firewalld
22
- fi
23
19
24
- # Disable SELinux.
25
- sudo setenforce 0
20
+ # Disable SELinux.
21
+ sudo setenforce 0
22
+ fi
26
23
27
24
# Useful packages
28
- if [[ " ${CLOUD_USER} " = " ubuntu" ]]
29
- then
25
+ if type apt; then
26
+ # Avoid the interactive dialog prompting for service restart: set policy to leave services unchanged
27
+ echo " \$ nrconf{restart} = 'l';" | sudo tee /etc/needrestart/conf.d/90-aufn.conf
30
28
sudo apt update
31
29
sudo apt install -y git tmux lvm2 iptables
32
30
else
42
40
sudo sysctl --load /etc/sysctl.d/70-ipv6.conf
43
41
44
42
# CentOS Stream 8 requires network-scripts. Rocky Linux 9 and onwards use NetworkManager.
45
- if [[ " ${CLOUD_USER} " = " cloud-user" ]]
46
- then
43
+ if type dnf; then
47
44
case $( grep -o " [89]\.[0-9]" /etc/redhat-release) in
48
45
" 8.*" )
49
46
sudo dnf install -y network-scripts
60
57
exit -1
61
58
;;
62
59
esac
60
+ elif type apt; then
61
+ # Prepare for disabling of Netplan and enabling of systemd-networkd.
62
+ # Netplan has an interaction with systemd and cloud-init to populate
63
+ # systemd-networkd files, but ephemerally. If /etc/systemd/network is
64
+ # empty and netplan config files are present in /run, copy them over.
65
+ persistent_netcfg=$( ls /etc/systemd/network)
66
+ ephemeral_netcfg=$( ls /run/systemd/network)
67
+ if [[ -z " $persistent_netcfg " && ! -z " $ephemeral_netcfg " ]]
68
+ then
69
+ echo " Creating persistent versions of Netplan ephemeral config"
70
+ sudo cp /run/systemd/network/* /etc/systemd/network
71
+ fi
63
72
fi
64
73
65
74
# Exit on error
68
77
set -e
69
78
70
79
# Ensure an ssh key is generated
80
+ CLOUD_USER=$( ls /home | grep -v lab | grep -v stack | head -1)
71
81
# NOTE: you might think ~${CLOUD_USER} would work but apparently not
72
82
CLOUD_USER_DIR=/home/${CLOUD_USER}
73
83
keyfile=" $HOME /.ssh/id_rsa"
86
96
sudo chown ${CLOUD_USER} .${CLOUD_USER} ${CLOUD_USER_DIR} /.ssh/authorized_keys
87
97
fi
88
98
89
- # Clone Kayobe .
99
+ # Clone Beokay .
90
100
cd $HOME
91
- [[ -d kayobe ]] || git clone https://opendev.org/openstack/kayobe.git -b stable/yoga
92
- cd kayobe
101
+ git clone https://github.com/stackhpc/beokay.git -b master
102
+
103
+ # Use Beokay to bootstrap your control host.
104
+ [[ -d deployment ]] || beokay/beokay.py create --base-path ~ /deployment --kayobe-repo https://opendev.org/openstack/kayobe.git --kayobe-branch stable/2023.1 --kayobe-config-repo https://github.com/stackhpc/a-universe-from-nothing.git --kayobe-config-branch stable/2023.1
93
105
94
106
# Bump the provisioning time - it can be lengthy on virtualised storage
95
- sed -i.bak ' s%^[# ]*wait_active_timeout:.*% wait_active_timeout: 5000%' ~ /kayobe/ansible/overcloud-provision.yml
107
+ sed -i.bak ' s%^[# ]*wait_active_timeout:.*% wait_active_timeout: 5000%' ~ /deployment/src/ kayobe/ansible/overcloud-provision.yml
96
108
97
109
# Clone the Tenks repository.
110
+ cd ~ /deployment/src/
98
111
[[ -d tenks ]] || git clone https://opendev.org/openstack/tenks.git
99
-
100
- # Clone this Kayobe configuration.
101
- mkdir -p config/src
102
- cd config/src/
103
- [[ -d kayobe-config ]] || git clone https://github.com/stackhpc/a-universe-from-nothing.git -b stable/yoga kayobe-config
112
+ cd
104
113
105
114
# Set default registry name to the one we just created
106
- sed -i.bak ' s/^docker_registry.*/docker_registry: ' $registry_ip ' :4000/' kayobe-config/etc/kayobe/docker.yml
115
+ sed -i.bak ' s/^docker_registry: .*/docker_registry: ' $registry_ip ' :4000/' ~ /deployment/src/ kayobe-config/etc/kayobe/docker.yml
107
116
108
117
# Configure host networking (bridge, routes & firewall)
109
- ./kayobe-config/configure-local-networking.sh
110
-
111
- # Install kayobe.
112
- cd ~ /kayobe
113
- ./dev/install-dev.sh
118
+ ~ /deployment/src/kayobe-config/configure-local-networking.sh
114
119
115
120
# Enable OVN flags
116
121
if $ENABLE_OVN
117
122
then
118
- cat << EOF | sudo tee -a config /src/kayobe-config/etc/kayobe/bifrost.yml
123
+ cat << EOF | sudo tee -a ~/deployment /src/kayobe-config/etc/kayobe/bifrost.yml
119
124
kolla_bifrost_extra_kernel_options:
120
125
- "console=ttyS0"
121
126
EOF
122
- cat << EOF | sudo tee -a config /src/kayobe-config/etc/kayobe/kolla.yml
127
+ cat << EOF | sudo tee -a ~/deployment /src/kayobe-config/etc/kayobe/kolla.yml
123
128
kolla_enable_ovn: yes
124
129
EOF
125
- cat << EOF | sudo tee -a config /src/kayobe-config/etc/kayobe/neutron.yml
130
+ cat << EOF | sudo tee -a ~/deployment /src/kayobe-config/etc/kayobe/neutron.yml
126
131
kolla_neutron_ml2_type_drivers:
127
132
- geneve
128
133
- vlan
@@ -134,17 +139,25 @@ kolla_neutron_ml2_tenant_network_types:
134
139
EOF
135
140
fi
136
141
142
+ # Set Environment variables for Kayobe dev scripts
143
+ export KAYOBE_CONFIG_SOURCE_PATH=~ /deployment/src/kayobe-config
144
+ export KAYOBE_VENV_PATH=~ /deployment/venvs/kayobe
145
+
137
146
# Deploy hypervisor services.
138
- . /dev/seed-hypervisor-deploy.sh
147
+ ~ /deployment/src/kayobe /dev/seed-hypervisor-deploy.sh
139
148
140
149
# Deploy a seed VM.
141
150
# NOTE: This should work the first time because the packet configuration uses a
142
151
# custom docker registry. However, there are sometimes issues with Docker starting up on the seed (FIXME)
143
- if ! . /dev/seed-deploy.sh; then
152
+ if ! ~ /deployment/src/kayobe /dev/seed-deploy.sh; then
144
153
# Deploy a seed VM. Should work this time.
145
- . /dev/seed-deploy.sh
154
+ ~ /deployment/src/kayobe /dev/seed-deploy.sh
146
155
fi
147
156
157
+ # Run TENKS
158
+ export TENKS_CONFIG_PATH=~ /deployment/src/kayobe-config/tenks.yml
159
+ ~ /deployment/src/kayobe/dev/tenks-deploy-overcloud.sh ~ /deployment/src/tenks
160
+
148
161
# Duration
149
162
duration=$SECONDS
150
163
echo " [INFO] $(( $duration / 60 )) minutes and $(( $duration % 60 )) seconds elapsed."
0 commit comments