You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.7 KiB
92 lines
2.7 KiB
#!/bin/bash
|
|
|
|
#Pour Fedora
|
|
#Depuis: https://cgruver.github.io/okd4-single-node-cluster/
|
|
|
|
#Prep
|
|
dnf update -y
|
|
dnf -y module install virt
|
|
|
|
#Paquets requis
|
|
dnf in -y virt wget git net-tools bind bind-utils bash-completion rsync libguestfs-tools virt-install epel-release libvirt-devel httpd-tools snf nginx
|
|
|
|
#Prep Virtualization
|
|
systemctl enable libvirtd --now
|
|
mkdir /VirtualMachines
|
|
virsh pool-destroy default
|
|
virsh pool-undefine default
|
|
virsh pool-define-as --name default --type dir --target /VirtualMachines
|
|
virsh pool-autostart default
|
|
virsh pool-start default
|
|
|
|
#Prep nginx
|
|
systemctl enable nginx --now
|
|
mkdir -p /usr/share/nginx/html/install/fcos/ignition
|
|
|
|
#Prep Firewalld
|
|
firewall-cmd --permanent --add-service=http
|
|
firewall-cmd --permanent --add-service=https
|
|
firewall-cmd --permanent --add-service=dns
|
|
firewall-cmd --reload
|
|
|
|
#Prep SSh Key
|
|
ssh-keygen -t ed25519 -N "" -f /root/.ssh/id_ed25519
|
|
|
|
|
|
mkdir -p /root/okd4-snc
|
|
cd /root/okd4-snc
|
|
git clone https://github.com/cgruver/okd4-single-node-cluster.git
|
|
cd okd4-single-node-cluster
|
|
mkdir ~/bin
|
|
cp ./bin/* ~/bin
|
|
chmod 750 ~/bin/*
|
|
|
|
####################################
|
|
###################################
|
|
##################################
|
|
cat <<'EOF' > ~/bin/setSncEnv.sh
|
|
#The domain that you want for your lab. This will be part of your DNS setup
|
|
export SNC_DOMAIN=snc.test
|
|
#The IP address of your snc-host host.
|
|
export SNC_HOST=192.168.222.29
|
|
export SNC_NAMESERVER=${SNC_HOST}
|
|
export SNC_NETMASK=24
|
|
export SNC_GATEWAY=192.168.222.1
|
|
|
|
#The IP address for your SNC master node. Take a free local IP
|
|
export MASTER_HOST=192.168.222.28
|
|
#IP for antoher host. same.
|
|
export BOOTSTRAP_HOST=192.168.222.27
|
|
#Current network we will work in
|
|
export SNC_NETWORK=192.168.222.0/24
|
|
export INSTALL_HOST_IP=${SNC_HOST}
|
|
export INSTALL_ROOT=/usr/share/nginx/html/install
|
|
export INSTALL_URL=http://${SNC_HOST}/install
|
|
export OKD4_SNC_PATH=/root/okd4-snc
|
|
export OKD_REGISTRY=quay.io/openshift/okd
|
|
|
|
EOF
|
|
|
|
##############################
|
|
#############################
|
|
|
|
|
|
echo ". /root/bin/setSncEnv.sh" >> ~/.bashrc
|
|
./root/bin/setSncEnv.sh
|
|
|
|
|
|
#NETWORKING
|
|
PRIMARY_NIC="eno1"
|
|
#add bridge
|
|
nmcli connection add type bridge ifname br0 con-name br0 ipv4.method manual ipv4.address "${SNC_HOST}/${SNC_NETMASK}" ipv4.gateway "${SNC_GATEWAY}" ipv4.dns "${SNC_NAMESERVER}" ipv4.dns-search "${SNC_DOMAIN}" ipv4.never-default no connection.autoconnect yes bridge.stp no ipv6.method ignore
|
|
#add nic to bridge
|
|
nmcli con add type ethernet con-name br0-bind-1 ifname ${PRIMARY_NIC} master br0
|
|
nmcli con del ${PRIMARY_NIC}
|
|
nmcli con add type ethernet con-name ${PRIMARY_NIC} ifname ${PRIMARY_NIC} connection.autoconnect no ipv4.method disabled ipv6.method ignore
|
|
|
|
#apply network
|
|
systemctl restart NetworkManager.service
|
|
#quick test
|
|
ping -c4 redhat.com
|
|
reboot
|