@@ -51,35 +51,57 @@ echo "
5151CloudStack Installer By 🅁🄾🄷🄸🅃 🅈🄰🄳🄰🅅
5252"
5353info " Installing Apache CloudStack All-In-One-Box"
54- info " NOTE: this works only on Ubuntu!"
54+ info " NOTE: this works only on Ubuntu, and run as 'root' user!"
55+
56+ if [[ $EUID -ne 0 ]]; then
57+ fatal " This script must be run as root"
58+ exit 1
59+ fi
60+
5561warn " Work in progress, try again while this is being hacked"
5662
5763# ## Setup Prerequisites ###
5864info " Installing dependencies"
59- apt-get update
65+ # apt-get update
6066apt-get install -y openssh-server sudo vim htop tar bridge-utils
6167
6268# ## Setup Bridge ###
6369
64- echo " network:
70+ # FIXME: we want to avoid virtual nics
71+ # ls -l /sys/class/net/ | grep -v virtual
72+
73+ interface=$( ls /sys/class/net/ | grep -v ' lo' | head -1)
74+ gateway=$( ip route show 0.0.0.0/0 dev ens3 | cut -d\ -f3)
75+ hostip=$( ip -f inet addr show $interface | sed -En -e ' s/.*inet ([0-9.]+).*/\1/p' )
76+
77+ info " Setting up bridge on $interface which has IP $hostip and gateway $gateway "
78+
79+ echo " network:
6580 version: 2
6681 renderer: networkd
6782 ethernets:
68- eno1 :
83+ $interface :
6984 dhcp4: false
7085 dhcp6: false
7186 optional: true
7287 bridges:
7388 cloudbr0:
74- addresses: [192.168.1.10 /24]
89+ addresses: [$hostip /24]
7590 routes:
7691 - to: default
77- via: 192.168.1.1
92+ via: $gateway
7893 nameservers:
79- addresses: [1.1.1.1, 8.8.8.8]
80- interfaces: [eno1 ]
94+ addresses: [8.8.8.8, 1.1.1.1 ]
95+ interfaces: [$interface ]
8196 dhcp4: false
8297 dhcp6: false
8398 parameters:
8499 stp: false
85- forward-delay: 0"
100+ forward-delay: 0" > /etc/netplan/01-netcfg.yaml
101+
102+ info " Disabling cloud-init netplan config"
103+ rm -f /etc/netplan/50-cloud-init.yaml
104+ echo " network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
105+
106+ netplan generate
107+ netplan apply
0 commit comments