File tree Expand file tree Collapse file tree 15 files changed +164
-52
lines changed
Expand file tree Collapse file tree 15 files changed +164
-52
lines changed Original file line number Diff line number Diff line change 1- www
2- key
1+ key *
2+ deploy /serve /www /*
3+ ! deploy /serve /www /bootfile
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ URL=https://192.168.0.230 USERNAME=Administrator PASSWORD=A0F7HKUU VALIDCERT=fal
1414
1515## How to Use This
1616
17- 1 . Building (NOTE: Ensure you are running the scripts from the ` deploy/scripts ` directory as they use relative paths)
17+ 1 . Building
1818 - Building ipxe.iso image
1919 - Use new/existing iPXE config file in ` deploy/build/ipxe/scripts `
2020 - Input its name as FILE variable in ` deploy/scripts/build-ipxe-iso.sh `
Original file line number Diff line number Diff line change 11services :
22 controller :
3- build : ./internal/controller
4- ports :
5- - 8081:8080
3+ build : ./internal/runner
4+ # ports:
5+ # - 8081:8080
6+ volumes :
7+ - ./deploy/ssh/key:/app/key:z
8+ - ./deploy/ansible:/app/ansible:z
9+ environment :
10+ - LC_ALL=en_US.UTF-8
11+ - USERNAME=Administrator
12+ - PASSWORD=A0F7HKUU
13+ - URL=https://192.168.0.230
14+ - VALIDCERT=false
15+ - WIPEINTERVAL=300
616 apache :
717 build : ./deploy/serve
818 volumes :
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Test
3+ hosts : all
4+ gather_facts : false
5+
6+ tasks :
7+ - name : Install python
8+ raw : test -e /usr/bin/python3 || apk add --no-cache python3
9+
10+ - name : Gather facts
11+ setup :
12+ vars :
13+ ansible_python_interpreter : /usr/bin/python3
Original file line number Diff line number Diff line change 1+ echo " Running script!"
Original file line number Diff line number Diff line change @@ -16,4 +16,9 @@ WORKDIR /build
1616RUN git clone https://github.com/ipxe/ipxe.git
1717WORKDIR /build/ipxe/src
1818
19- CMD make -j${ISO_MAKE_THREADS} bin/ipxe.iso EMBED=/input/${FILE} && mv bin/ipxe.iso /output/ipxe.iso
19+ RUN sed -i 's$//#define PING_CMD$#define PING_CMD$g' config/general.h &&\
20+ sed -i 's$//#define NET_PROTO_IPV6$#define NET_PROTO_IPV6$g' config/general.h &&\
21+ sed -i 's/undef.*DOWNLOAD_PROTO_HTTPS/define DOWNLOAD_PROTO_HTTPS/g' config/general.h
22+
23+ CMD make -j${ISO_MAKE_THREADS} bin/ipxe.iso EMBED=/input/${FILE} \
24+ && mv bin/ipxe.iso /output/ipxe.iso
Original file line number Diff line number Diff line change 11#!ipxe
22
3- # The iPXE script below is based on:
4- # https://boot.alpinelinux.org/boot.ipxe
3+ echo Setting temporary DHCP address to chain into bootfile
4+ dhcp
55
6- ifopen
7- ifstat
8- set net0/ip:ipv4 192.168.0.231
9- set net0/netmask:ipv4 255.255.255.0
10- set net0/gateway:ipv4 192.168.0.1
11- set net0/dns:ipv4 192.168.0.1
12- ifopen net0
13-
14- set serverip 192.168.0.170
15-
16- set console console=tty0
17- set cmdline modules=loop,squashfs nomodeset
18- set branch v3.20
19- set flavor lts
20- set arch x86_64
21- set img-url http://${serverip}/iso/alpine-netboot/boot
22- set modloop-url ${img-url}/modloop-${flavor}
23-
24- imgfree
25- kernel ${img-url}/vmlinuz-${flavor} ${cmdline} init=/sbin/init ${console} modloop=${modloop-url} ip=192.168.0.231
26- initrd ${img-url}/initramfs-${flavor}
27- boot
6+ set chain-url http://192.168.0.160:8080/bootfile
7+ echo Chaining to ${chain_url}
8+ chain ${chain-url}?uuid=${uuid}
Original file line number Diff line number Diff line change 33# The iPXE script below is based on:
44# https://boot.alpinelinux.org/boot.ipxe
55
6- #!ipxe
7-
86dhcp
97
108set console console=tty0
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ cd " $( dirname " $0 " ) "
23
34PODMAN_IMAGE_NAME=" alpine_builder"
45WWW_DIR=" ../serve/www/iso/alpine-netboot"
@@ -8,7 +9,7 @@ echo "--- Creating directory at ${WWW_DIR} ---"
89mkdir -p ${WWW_DIR}
910
1011echo " --- Building ${PODMAN_IMAGE_NAME} ---"
11- podman build --no-cache -- tag ${PODMAN_IMAGE_NAME} ${BUILD_DIR}
12+ podman build --tag ${PODMAN_IMAGE_NAME} ${BUILD_DIR}
1213
1314echo " --- Running ${PODMAN_IMAGE_NAME} ---"
1415podman run --rm -v ${WWW_DIR} :/output:z \
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ cd " $( dirname " $0 " ) "
23
3- FILE=" vm-test .ipxe"
4+ FILE=" alpinebooter .ipxe"
45
56WWW_DIR=" ../serve/www"
67BUILD_DIR=" ../build/ipxe"
78PODMAN_IMAGE_NAME=" ipxe_builder"
9+ SSH_KEY_DIR=" ../ssh"
810ISO_MAKE_THREADS=16
911
1012echo " --- Creating serve directory at ${WWW_DIR} ---"
1113mkdir -p ${WWW_DIR}
1214
13- echo " --- Generating new SSH key pair ---"
14- ssh-keygen -t rsa -f ../build/key -N " "
15+ echo " --- Creating ssh key directory at ${SSH_KEY_DIR} ---"
16+ mkdir -p ${SSH_KEY_DIR}
17+
18+ echo " --- Generating new SSH key pair in ${SSH_KEY_DIR} ---"
19+ ssh-keygen -t rsa -f ${SSH_KEY_DIR} /key -N " "
1520
1621echo " --- Copying public SSH key to ${WWW_DIR} ---"
1722mkdir -p ${WWW_DIR} /ssh
18- mv -f ../build /key.pub ${WWW_DIR} /ssh/key.pub
23+ mv -f ${SSH_KEY_DIR} /key.pub ${WWW_DIR} /ssh/key.pub
1924
2025echo " --- Setting correct permissions for private key ---"
21- chmod 600 ../build/key
26+ chmod 600 ${SSH_KEY_DIR} /key
27+
28+ # echo "--- Building ${PODMAN_IMAGE_NAME} ---"
29+ # podman build \
30+ # --tag ${PODMAN_IMAGE_NAME} \
31+ # ${BUILD_DIR}
2232
23- echo " --- Building ${PODMAN_IMAGE_NAME} ---"
24- podman build \
25- --tag ${PODMAN_IMAGE_NAME} \
26- --no-cache \
27- ${BUILD_DIR}
33+ if [ $? -ne q 0 ]; then
34+ echo " !!! BUILD FAILED, EXITING !!!"
35+ exit
36+ fi
2837
2938echo " --- Building ipxe.iso with ${FILE} embedded, writing to ${WWW_DIR} (using ${ISO_MAKE_THREADS} threads) ---"
3039podman run \
You can’t perform that action at this time.
0 commit comments