Skip to content

Commit

Permalink
Merge pull request #7 from GlueOps/feat/refactor
Browse files Browse the repository at this point in the history
feat: refactor into smaller scripts and added tailscale installation
  • Loading branch information
NichArchA82 authored May 25, 2024
2 parents 4639329 + 8c04979 commit 0971bf9
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 96 deletions.
45 changes: 45 additions & 0 deletions i-prox-deb-1-of-3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

#Populate variables to generate /etc/hosts and /etc/network/interfaces files
INTERFACE_PORT=$(ip -br addr | grep 'UP' | grep -v '127.0.0.1' | grep -v '::1/128' | awk '{print $1}')
echo $INTERFACE_PORT


INTERFACE_NAME=$(udevadm info -q property /sys/class/net/$INTERFACE_PORT | grep "ID_NET_NAME_PATH=" | cut -d'=' -f2)
IP_CIDR=$(ip addr show $INTERFACE_PORT | grep "inet\b" | awk '{print $2}')
GATEWAY=$(ip route | grep default | awk '{print $3}')
IP_ADDRESS=$(echo "$IP_CIDR" | cut -d'/' -f1)
CIDR=$(echo "$IP_CIDR" | cut -d'/' -f2)

#Configure the network /ect/network/interfaces and create backup of old one
cat > ~/interfaces << EOF
auto lo
iface lo inet loopback
iface $INTERFACE_NAME inet manual
auto vmbr0
iface vmbr0 inet static
address $IP_ADDRESS/$CIDR
gateway $GATEWAY
bridge_ports $INTERFACE_NAME
bridge_stp off
bridge_fd 0
source /etc/network/interfaces.d/*
EOF

#Add Repository
echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list

#Add repository Key
wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

#Update system
apt update && apt full-upgrade -y

#Install Proxmox kernel and reboot
apt install proxmox-default-kernel -y
sysctl -w kernel.panic=10
reboot now
33 changes: 33 additions & 0 deletions i-prox-deb-2-of-3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# Set debconf selections for Postfix
echo "postfix postfix/main_mailer_type select Local only" | debconf-set-selections
echo "postfix postfix/mailname string ''" | debconf-set-selections

# Install proxmox packages
apt install -y proxmox-ve postfix open-iscsi chrony

#Reomove the debian kernel and update grub
apt remove linux-image-amd64 'linux-image-6.1*' -y
update-grub

#remove OS Prober
apt remove os-prober -y

#If you are not using a license key remove the enterprise repository
rm /etc/apt/sources.list.d/pve-enterprise.list

#Update the system
apt update && apt dist-upgrade -y

#Setup a software defined network
apt install libpve-network-perl frr-pythontools dnsmasq -y
systemctl disable --now dnsmasq

#move the interfaces and back up the old
mv /etc/network/interfaces /etc/network/interfaces.old
mv ~/interfaces /etc/network/interfaces.new

#Reboot to finalize all the changes
sysctl -w kernel.panic=10
reboot now
13 changes: 13 additions & 0 deletions i-prox-deb-3-of-3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
read -p "Enter your tailscale auth key: " TAILSCALE_AUTH_KEY

#Set the software defined network
pvesh create /cluster/sdn/zones -type simple -zone zone0 -dhcp dnsmasq -ipam pve
pvesh create /cluster/sdn/vnets -vnet vnet0 -zone zone0
pvesh create /cluster/sdn/vnets/vnet0/subnets --subnet 10.0.0.0/16 --type subnet --dhcp-range start-address=10.0.0.50,end-address=10.0.255.254 --gateway 10.0.0.1 --snat 1
pvesh set /cluster/sdn

#Set up tailscale
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up --authkey=${TAILSCALE_AUTH_KEY}
sudo tailscale set --ssh
96 changes: 0 additions & 96 deletions proxmox-new-setup.sh

This file was deleted.

0 comments on commit 0971bf9

Please sign in to comment.