Removes PXE booting from dnsmasq setup.
This commit is contained in:
@@ -68,85 +68,92 @@ fi
|
|||||||
|
|
||||||
# Create setup bundle.
|
# Create setup bundle.
|
||||||
|
|
||||||
# Copy iPXE bootloader to ipxe-web from cached assets.
|
# The following was a completely fine process for making your dnsmasq server
|
||||||
echo "Copying Talos PXE assets from cache..."
|
# also serve PXE boot assets for the cluster. However, after using it for a bit,
|
||||||
PXE_WEB_ROOT="${BUNDLE_DIR}/ipxe-web"
|
# it seems to be more complexity for no additional benefit when the operators
|
||||||
mkdir -p "${PXE_WEB_ROOT}/amd64"
|
# can just use USB keys.
|
||||||
cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
|
||||||
|
|
||||||
# Get schematic ID from override or config
|
## Setup PXE boot assets
|
||||||
if [ -n "$SCHEMATIC_ID_OVERRIDE" ]; then
|
|
||||||
SCHEMATIC_ID="$SCHEMATIC_ID_OVERRIDE"
|
|
||||||
echo "Using schematic ID from command line: $SCHEMATIC_ID"
|
|
||||||
else
|
|
||||||
SCHEMATIC_ID=$(wild-config cluster.nodes.talos.schematicId)
|
|
||||||
if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
|
||||||
echo "Error: No schematic ID found in config"
|
|
||||||
echo "Please run 'wild-setup' first to configure your cluster"
|
|
||||||
echo "Or specify one with --schematic-id option"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Using schematic ID from config: $SCHEMATIC_ID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Define cache directories using new structure
|
# # Copy iPXE bootloader to ipxe-web from cached assets.
|
||||||
CACHE_DIR="${WC_HOME}/.wildcloud"
|
# echo "Copying Talos PXE assets from cache..."
|
||||||
SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
# PXE_WEB_ROOT="${BUNDLE_DIR}/ipxe-web"
|
||||||
PXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/pxe"
|
# mkdir -p "${PXE_WEB_ROOT}/amd64"
|
||||||
IPXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/ipxe"
|
# cp "${DNSMASQ_SETUP_DIR}/boot.ipxe" "${PXE_WEB_ROOT}/boot.ipxe"
|
||||||
|
|
||||||
# Check if cached assets exist
|
# # Get schematic ID from override or config
|
||||||
KERNEL_CACHE_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
# if [ -n "$SCHEMATIC_ID_OVERRIDE" ]; then
|
||||||
INITRAMFS_CACHE_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
# SCHEMATIC_ID="$SCHEMATIC_ID_OVERRIDE"
|
||||||
|
# echo "Using schematic ID from command line: $SCHEMATIC_ID"
|
||||||
|
# else
|
||||||
|
# SCHEMATIC_ID=$(wild-config cluster.nodes.talos.schematicId)
|
||||||
|
# if [ -z "$SCHEMATIC_ID" ] || [ "$SCHEMATIC_ID" = "null" ]; then
|
||||||
|
# echo "Error: No schematic ID found in config"
|
||||||
|
# echo "Please run 'wild-setup' first to configure your cluster"
|
||||||
|
# echo "Or specify one with --schematic-id option"
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
# echo "Using schematic ID from config: $SCHEMATIC_ID"
|
||||||
|
# fi
|
||||||
|
|
||||||
if [ ! -f "${KERNEL_CACHE_PATH}" ] || [ ! -f "${INITRAMFS_CACHE_PATH}" ]; then
|
# # Define cache directories using new structure
|
||||||
echo "Error: Talos PXE assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
# CACHE_DIR="${WC_HOME}/.wildcloud"
|
||||||
echo "Expected locations:"
|
# SCHEMATIC_CACHE_DIR="${CACHE_DIR}/node-boot-assets/${SCHEMATIC_ID}"
|
||||||
echo " Kernel: ${KERNEL_CACHE_PATH}"
|
# PXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/pxe"
|
||||||
echo " Initramfs: ${INITRAMFS_CACHE_PATH}"
|
# IPXE_CACHE_DIR="${SCHEMATIC_CACHE_DIR}/ipxe"
|
||||||
echo ""
|
|
||||||
echo "Please run 'wild-cluster-node-boot-assets-download' first to download and cache the assets."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy Talos PXE assets from cache
|
# # Check if cached assets exist
|
||||||
echo "Copying Talos kernel from cache..."
|
# KERNEL_CACHE_PATH="${PXE_CACHE_DIR}/amd64/vmlinuz"
|
||||||
cp "${KERNEL_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/vmlinuz"
|
# INITRAMFS_CACHE_PATH="${PXE_CACHE_DIR}/amd64/initramfs.xz"
|
||||||
echo "✅ Talos kernel copied from cache"
|
|
||||||
|
|
||||||
echo "Copying Talos initramfs from cache..."
|
# if [ ! -f "${KERNEL_CACHE_PATH}" ] || [ ! -f "${INITRAMFS_CACHE_PATH}" ]; then
|
||||||
cp "${INITRAMFS_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/initramfs.xz"
|
# echo "Error: Talos PXE assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
||||||
echo "✅ Talos initramfs copied from cache"
|
# echo "Expected locations:"
|
||||||
|
# echo " Kernel: ${KERNEL_CACHE_PATH}"
|
||||||
|
# echo " Initramfs: ${INITRAMFS_CACHE_PATH}"
|
||||||
|
# echo ""
|
||||||
|
# echo "Please run 'wild-cluster-node-boot-assets-download' first to download and cache the assets."
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
|
||||||
# Copy iPXE bootloader files from cache
|
# # Copy Talos PXE assets from cache
|
||||||
echo "Copying iPXE bootloader files from cache..."
|
# echo "Copying Talos kernel from cache..."
|
||||||
FTPD_DIR="${BUNDLE_DIR}/pxe-ftpd"
|
# cp "${KERNEL_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/vmlinuz"
|
||||||
mkdir -p "${FTPD_DIR}"
|
# echo "✅ Talos kernel copied from cache"
|
||||||
|
|
||||||
# Check if iPXE assets exist in cache
|
# echo "Copying Talos initramfs from cache..."
|
||||||
IPXE_EFI_CACHE="${IPXE_CACHE_DIR}/ipxe.efi"
|
# cp "${INITRAMFS_CACHE_PATH}" "${PXE_WEB_ROOT}/amd64/initramfs.xz"
|
||||||
IPXE_BIOS_CACHE="${IPXE_CACHE_DIR}/undionly.kpxe"
|
# echo "✅ Talos initramfs copied from cache"
|
||||||
IPXE_ARM64_CACHE="${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
|
||||||
|
|
||||||
if [ ! -f "${IPXE_EFI_CACHE}" ] || [ ! -f "${IPXE_BIOS_CACHE}" ] || [ ! -f "${IPXE_ARM64_CACHE}" ]; then
|
# # Copy iPXE bootloader files from cache
|
||||||
echo "Error: iPXE bootloader assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
# echo "Copying iPXE bootloader files from cache..."
|
||||||
echo "Expected locations:"
|
# FTPD_DIR="${BUNDLE_DIR}/pxe-ftpd"
|
||||||
echo " iPXE EFI: ${IPXE_EFI_CACHE}"
|
# mkdir -p "${FTPD_DIR}"
|
||||||
echo " iPXE BIOS: ${IPXE_BIOS_CACHE}"
|
|
||||||
echo " iPXE ARM64: ${IPXE_ARM64_CACHE}"
|
|
||||||
echo ""
|
|
||||||
echo "Please run 'wild-cluster-node-boot-assets-download' first to download and cache the assets."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy iPXE assets from cache
|
# # Check if iPXE assets exist in cache
|
||||||
cp "${IPXE_EFI_CACHE}" "${FTPD_DIR}/ipxe.efi"
|
# IPXE_EFI_CACHE="${IPXE_CACHE_DIR}/ipxe.efi"
|
||||||
cp "${IPXE_BIOS_CACHE}" "${FTPD_DIR}/undionly.kpxe"
|
# IPXE_BIOS_CACHE="${IPXE_CACHE_DIR}/undionly.kpxe"
|
||||||
cp "${IPXE_ARM64_CACHE}" "${FTPD_DIR}/ipxe-arm64.efi"
|
# IPXE_ARM64_CACHE="${IPXE_CACHE_DIR}/ipxe-arm64.efi"
|
||||||
echo "✅ iPXE bootloader files copied from cache"
|
|
||||||
|
# if [ ! -f "${IPXE_EFI_CACHE}" ] || [ ! -f "${IPXE_BIOS_CACHE}" ] || [ ! -f "${IPXE_ARM64_CACHE}" ]; then
|
||||||
|
# echo "Error: iPXE bootloader assets not found in cache for schematic ID: ${SCHEMATIC_ID}"
|
||||||
|
# echo "Expected locations:"
|
||||||
|
# echo " iPXE EFI: ${IPXE_EFI_CACHE}"
|
||||||
|
# echo " iPXE BIOS: ${IPXE_BIOS_CACHE}"
|
||||||
|
# echo " iPXE ARM64: ${IPXE_ARM64_CACHE}"
|
||||||
|
# echo ""
|
||||||
|
# echo "Please run 'wild-cluster-node-boot-assets-download' first to download and cache the assets."
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# # Copy iPXE assets from cache
|
||||||
|
# cp "${IPXE_EFI_CACHE}" "${FTPD_DIR}/ipxe.efi"
|
||||||
|
# cp "${IPXE_BIOS_CACHE}" "${FTPD_DIR}/undionly.kpxe"
|
||||||
|
# cp "${IPXE_ARM64_CACHE}" "${FTPD_DIR}/ipxe-arm64.efi"
|
||||||
|
# echo "✅ iPXE bootloader files copied from cache"
|
||||||
|
|
||||||
|
|
||||||
cp "${DNSMASQ_SETUP_DIR}/nginx.conf" "${BUNDLE_DIR}/nginx.conf"
|
# cp "${DNSMASQ_SETUP_DIR}/nginx.conf" "${BUNDLE_DIR}/nginx.conf"
|
||||||
cp "${DNSMASQ_SETUP_DIR}/dnsmasq.conf" "${BUNDLE_DIR}/dnsmasq.conf"
|
cp "${DNSMASQ_SETUP_DIR}/dnsmasq.conf" "${BUNDLE_DIR}/dnsmasq.conf"
|
||||||
cp "${DNSMASQ_SETUP_DIR}/setup.sh" "${BUNDLE_DIR}/setup.sh"
|
cp "${DNSMASQ_SETUP_DIR}/setup.sh" "${BUNDLE_DIR}/setup.sh"
|
||||||
|
|
||||||
|
@@ -16,24 +16,23 @@ server=1.1.1.1
|
|||||||
server=8.8.8.8
|
server=8.8.8.8
|
||||||
|
|
||||||
# --- DHCP Settings ---
|
# --- DHCP Settings ---
|
||||||
dhcp-range={{ .cloud.dhcpRange }},12h
|
# dhcp-range={{ .cloud.dhcpRange }},12h
|
||||||
dhcp-option=3,{{ .cloud.router.ip }} # gateway to assign
|
# dhcp-option=3,{{ .cloud.router.ip }} # gateway to assign
|
||||||
dhcp-option=6,{{ .cloud.dns.ip }} # dns to assign
|
# dhcp-option=6,{{ .cloud.dns.ip }} # dns to assign
|
||||||
|
|
||||||
# --- PXE Booting ---
|
# --- PXE Booting ---
|
||||||
enable-tftp
|
# enable-tftp
|
||||||
tftp-root=/var/ftpd
|
# tftp-root=/var/ftpd
|
||||||
|
|
||||||
dhcp-match=set:efi-x86_64,option:client-arch,7
|
# dhcp-match=set:efi-x86_64,option:client-arch,7
|
||||||
dhcp-boot=tag:efi-x86_64,ipxe.efi
|
# dhcp-boot=tag:efi-x86_64,ipxe.efi
|
||||||
dhcp-boot=tag:!efi-x86_64,undionly.kpxe
|
# dhcp-boot=tag:!efi-x86_64,undionly.kpxe
|
||||||
|
|
||||||
dhcp-match=set:efi-arm64,option:client-arch,11
|
# dhcp-match=set:efi-arm64,option:client-arch,11
|
||||||
dhcp-boot=tag:efi-arm64,ipxe-arm64.efi
|
# dhcp-boot=tag:efi-arm64,ipxe-arm64.efi
|
||||||
|
|
||||||
dhcp-userclass=set:ipxe,iPXE
|
# dhcp-userclass=set:ipxe,iPXE
|
||||||
dhcp-boot=tag:ipxe,http://{{ .cloud.dns.ip }}/boot.ipxe
|
# dhcp-boot=tag:ipxe,http://{{ .cloud.dns.ip }}/boot.ipxe
|
||||||
|
|
||||||
log-queries
|
log-queries
|
||||||
log-dhcp
|
# log-dhcp
|
||||||
|
|
||||||
|
@@ -9,43 +9,43 @@ echo "Installing dnsmasq and nginx."
|
|||||||
sudo apt install -y dnsmasq nginx
|
sudo apt install -y dnsmasq nginx
|
||||||
|
|
||||||
DNSMASQ_SETUP_DIR="."
|
DNSMASQ_SETUP_DIR="."
|
||||||
PXE_FTPD_DIR="${DNSMASQ_SETUP_DIR}/pxe-ftpd"
|
# PXE_FTPD_DIR="${DNSMASQ_SETUP_DIR}/pxe-ftpd"
|
||||||
PXE_WEB_ROOT="${DNSMASQ_SETUP_DIR}/ipxe-web"
|
# PXE_WEB_ROOT="${DNSMASQ_SETUP_DIR}/ipxe-web"
|
||||||
|
|
||||||
# Configure nginx.
|
# Configure nginx.
|
||||||
echo "Configuring nginx."
|
# echo "Configuring nginx."
|
||||||
sudo cp "${DNSMASQ_SETUP_DIR}/nginx.conf" /etc/nginx/sites-available/talos
|
# sudo cp "${DNSMASQ_SETUP_DIR}/nginx.conf" /etc/nginx/sites-available/talos
|
||||||
sudo chown www-data:www-data /etc/nginx/sites-available/talos
|
# sudo chown www-data:www-data /etc/nginx/sites-available/talos
|
||||||
sudo chmod -R 755 /etc/nginx/sites-available/talos
|
# sudo chmod -R 755 /etc/nginx/sites-available/talos
|
||||||
|
|
||||||
# Copy assets to nginx web root
|
# Copy assets to nginx web root
|
||||||
echo "Copying Talos PXE boot assets to nginx web root."
|
# echo "Copying Talos PXE boot assets to nginx web root."
|
||||||
TALOS_PXE_WEB_ROOT="/var/www/html/talos"
|
# TALOS_PXE_WEB_ROOT="/var/www/html/talos"
|
||||||
sudo mkdir -p "${TALOS_PXE_WEB_ROOT}"
|
# sudo mkdir -p "${TALOS_PXE_WEB_ROOT}"
|
||||||
sudo rm -rf ${TALOS_PXE_WEB_ROOT}/* # Clean the web root directory
|
# sudo rm -rf ${TALOS_PXE_WEB_ROOT}/* # Clean the web root directory
|
||||||
sudo cp -r ${PXE_WEB_ROOT}/* "${TALOS_PXE_WEB_ROOT}"
|
# sudo cp -r ${PXE_WEB_ROOT}/* "${TALOS_PXE_WEB_ROOT}"
|
||||||
sudo chown -R www-data:www-data "${TALOS_PXE_WEB_ROOT}"
|
# sudo chown -R www-data:www-data "${TALOS_PXE_WEB_ROOT}"
|
||||||
sudo chmod -R 755 "${TALOS_PXE_WEB_ROOT}"
|
# sudo chmod -R 755 "${TALOS_PXE_WEB_ROOT}"
|
||||||
|
|
||||||
# Start nginx service to serve the iPXE script and images
|
# Start nginx service to serve the iPXE script and images
|
||||||
echo "Starting nginx service."
|
# echo "Starting nginx service."
|
||||||
sudo ln -s /etc/nginx/sites-available/talos /etc/nginx/sites-enabled/talos > /dev/null 2>&1 || true
|
# sudo ln -s /etc/nginx/sites-available/talos /etc/nginx/sites-enabled/talos > /dev/null 2>&1 || true
|
||||||
sudo rm -f /etc/nginx/sites-enabled/default
|
# sudo rm -f /etc/nginx/sites-enabled/default
|
||||||
sudo systemctl reload nginx
|
# sudo systemctl reload nginx
|
||||||
|
|
||||||
# Stop and disable systemd-resolved if it is running
|
# Stop and disable systemd-resolved if it is running
|
||||||
if systemctl is-active --quiet systemd-resolved; then
|
# if systemctl is-active --quiet systemd-resolved; then
|
||||||
echo "Stopping and disabling systemd-resolved..."
|
# echo "Stopping and disabling systemd-resolved..."
|
||||||
sudo systemctl disable systemd-resolved
|
# sudo systemctl disable systemd-resolved
|
||||||
sudo systemctl stop systemd-resolved
|
# sudo systemctl stop systemd-resolved
|
||||||
# sudo rm -f /etc/resolv.conf
|
# # sudo rm -f /etc/resolv.conf
|
||||||
echo "systemd-resolved stopped and disabled"
|
# echo "systemd-resolved stopped and disabled"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Update PXE's iPXE bootloader files.
|
# Update PXE's iPXE bootloader files.
|
||||||
echo "Updating iPXE ftpd bootloader files."
|
# echo "Updating iPXE ftpd bootloader files."
|
||||||
sudo mkdir -p /var/ftpd
|
# sudo mkdir -p /var/ftpd
|
||||||
sudo cp ${PXE_FTPD_DIR}/* /var/ftpd/
|
# sudo cp ${PXE_FTPD_DIR}/* /var/ftpd/
|
||||||
|
|
||||||
# Finally, install and configure DNSMasq.
|
# Finally, install and configure DNSMasq.
|
||||||
echo "Configuring and starting DNSMasq."
|
echo "Configuring and starting DNSMasq."
|
||||||
|
Reference in New Issue
Block a user