Compare commits
2 Commits
cc421f69de
...
fae6ceff86
| Author | SHA1 | Date | |
|---|---|---|---|
|
fae6ceff86
|
|||
|
33fc7ef33d
|
@@ -1,2 +1,3 @@
|
||||
dhcp:
|
||||
server:
|
||||
tftpIp: 10.0.0.3
|
||||
httpUrl: http://10.0.0.3:8000
|
||||
|
||||
@@ -20,6 +20,7 @@ dns:
|
||||
- 8.8.8.8
|
||||
ntp: nl.pool.ntp.org
|
||||
install: true
|
||||
autoInstall: false
|
||||
patches:
|
||||
- !patch hostname
|
||||
- !patch install-disk
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
netmask: 255.255.255.0
|
||||
gateway: 192.168.1.1
|
||||
installDisk: /dev/vda
|
||||
autoInstall: true
|
||||
cluster:
|
||||
name: testing
|
||||
controlPlaneIp: 192.168.1.100
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!ipxe
|
||||
|
||||
dhcp
|
||||
|
||||
echo Starting ${serial}
|
||||
@@ -13,9 +12,12 @@ goto node_${serial} || exit
|
||||
# {{ node.filename }}
|
||||
:node_{{ node.serial }}
|
||||
{% set ipArg = "ip=" ~ [node.ip, "" , node.gateway, node.netmask, node.hostname, node.interface, "", node.dns[0], node.dns[1], node.ntp]|join(":") -%}
|
||||
{% set kernelArgs = [ipArg, node.kernelArgs|join(" "), node.extraKernelArgs|join(" ")]|join(" ") -%}
|
||||
{% set kernelArgs = [ipArg, node.kernelArgs|join(" "), node.extraKernelArgs|join(" ")] -%}
|
||||
{% if node.autoInstall %}
|
||||
{% do kernelArgs.append("talos.config=" ~ config.server.httpUrl ~ "/configs/" ~ node.filename ~ ".yaml") %}
|
||||
{% endif %}
|
||||
imgfree
|
||||
kernel https://pxe.factory.talos.dev/image/{{ node.schematicId }}/{{ node.talosVersion }}/kernel-{{ node.arch }} {{ kernelArgs }}
|
||||
kernel https://pxe.factory.talos.dev/image/{{ node.schematicId }}/{{ node.talosVersion }}/kernel-{{ node.arch }} {{ kernelArgs|join(" ") }}
|
||||
initrd https://pxe.factory.talos.dev/image/{{ node.schematicId }}/{{ node.talosVersion }}/initramfs-{{ node.arch }}.xz
|
||||
boot
|
||||
{% endif %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% set tftpIp = config.dhcp.tftpIp -%}
|
||||
{% set tftpIp = config.server.tftpIp -%}
|
||||
|
||||
enable-tftp
|
||||
tftp-root=/tftproot
|
||||
|
||||
@@ -6,6 +6,7 @@ IPXE_VERSION=b41bda4413bf286d7b7a449bc05e1531da1eec2e
|
||||
IPXE_BIN=(bin/ipxe.pxe bin-x86_64-efi/ipxe.efi)
|
||||
|
||||
IPXE_DIR=${ROOT}/.ipxe/ipxe-${IPXE_VERSION}
|
||||
HTTP_URL=$(cat ${ROOT}/config.yaml | yq .server.httpUrl)
|
||||
|
||||
function download_ipxe() {
|
||||
base_dir=$(dirname ${IPXE_DIR})
|
||||
@@ -25,7 +26,8 @@ function patch_ipxe() {
|
||||
#!ipxe
|
||||
|
||||
dhcp
|
||||
chain boot.ipxe || shell
|
||||
chain http://10.0.0.3:8000/boot.ipxe || shell
|
||||
# chain boot.ipxe || shell
|
||||
EOF
|
||||
|
||||
cd - > /dev/null
|
||||
@@ -44,6 +46,7 @@ function build_ipxe() {
|
||||
|
||||
function render() {
|
||||
${ROOT}/tools/render
|
||||
${ROOT}/rendered/generate_configs.sh
|
||||
}
|
||||
|
||||
function host_tftp() {
|
||||
@@ -64,8 +67,30 @@ function host_tftp() {
|
||||
sudo in.tftpd --verbosity 100 --permissive -L --secure ${TFTP_DIR}
|
||||
}
|
||||
|
||||
function host_http() {
|
||||
HTTP_DIR=$(mktemp --tmpdir -d http.XXX)
|
||||
chmod 755 ${HTTP_DIR}
|
||||
function cleanup() {
|
||||
rm -rf ${HTTP_DIR}
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
ln -s ${ROOT}/rendered/boot.ipxe ${HTTP_DIR}
|
||||
for bin in "${IPXE_BIN[@]}"; do
|
||||
path=${IPXE_DIR}/src/${bin}
|
||||
ln -s ${path} ${HTTP_DIR}
|
||||
done
|
||||
|
||||
ln -s ${ROOT}/configs ${HTTP_DIR}
|
||||
|
||||
echo "Starting http"
|
||||
cd ${HTTP_DIR}
|
||||
python -m http.server 8000
|
||||
cd -
|
||||
}
|
||||
|
||||
download_ipxe
|
||||
patch_ipxe
|
||||
build_ipxe
|
||||
render
|
||||
host_tftp
|
||||
host_http
|
||||
Reference in New Issue
Block a user