Add additional OS installer images
- Debian 11, Ubuntu 20.04, and OpenBSD 7.0 images
- Menu is too long, so added pxeboot_boot_images list to determine
which images to download/include in menu
- Update versions and checksums downloaded for existing images, and use
version specific paths where applicable.
- Update boot parameters to better support EFI booting
- Update galaxy metadata
Change-Id: Iab6d4385489458ff0e4491c4b1de544b442c2622
diff --git a/.reuse/dep5 b/.reuse/dep5
index 36ce305..40fef72 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -1,5 +1,5 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Files: .cookiecutter_params.json VERSION .gitreview
+Files: .cookiecutter_params.json VERSION .gitreview README.md
Copyright: 2020 Open Networking Foundation
License: Apache-2.0
diff --git a/README.md b/README.md
index 995d700..0ed4999 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,3 @@
-<!--
-SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
-SPDX-License-Identifier: Apache-2.0
---!>
# pxeboot
Configures PXE and iPXE related boot scripts and images on an web server.
@@ -14,6 +10,8 @@
- Gives options for installation (interactive and autoinstall) and diagnostic
tools (currently: memtest)
- Alternate options to help debug or supply nonfree firmware
+- List of images in the iPXE menu is specified by the `pxeboot_boot_images`
+ variable for customizing which tools are available.
- By default, continues boot normally after 10 seconds
Also populates the kernel, initrd, and other files needed to network boot.
@@ -46,6 +44,14 @@
initialize network cards), which can be supplied during boot as another
cpio file: https://wiki.debian.org/DebianInstaller/NetbootFirmware
+Additional references:
+
+https://wiki.debian.org/DebianInstaller/Preseed
+https://wiki.ubuntu.com/UEFI/PXE-netboot-install
+https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
+
+iPXE script examples: https://github.com/netbootxyz/netboot.xyz
+
## Example Playbook
```yaml
diff --git a/defaults/main.yml b/defaults/main.yml
index d280cc4..16dd086 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -11,6 +11,18 @@
# dist dir, where downloaded files are stored
pxeboot_dist_dir: "/opt/dist/pxeboot"
+# List of boot images to include
+pxeboot_boot_images:
+ - memtest
+ - debian10
+ - debian11
+ - ubuntu1804
+ - ubuntu2004
+ - openbsd70
+
+# whether or not to include debug options
+pxeboot_image_debug: true
+
# memtest image
# see: https://ipxe.org/appnote/memtest
pxeboot_memtest_version: "5.01"
@@ -26,37 +38,79 @@
# Debian 10 image
pxeboot_debian10_base_url: "https://deb.debian.org/debian/dists/buster/main/installer-amd64"
-pxeboot_debian10_version: "current/images/netboot/debian-installer/amd64/"
+pxeboot_debian10_version: "20190702+deb10u11/images/netboot/debian-installer/amd64/"
-# checksums from version as of 2021-03-22
+# checksums from version as of 2021-11-27
pxeboot_debian10_files:
- name: "linux"
- checksum: "sha256:d758470d7d1b4148309533e73de20ad2276fa861ce4dabaf0dae360f782fa1fa"
+ checksum: "sha256:8c8a24cf5d65c33c2675d4226dea4f8412c9cfc2046f50ba440e037b47465147"
- name: "initrd.gz"
- checksum: "sha256:0410d8d013be5275c82c04e780307b76f520ad1859e9eb771c82aaef858a2ba6"
+ checksum: "sha256:b6b59929f3fcc1d55d16e573a063e403855ead009343117f36c022b7bff00edf"
pxeboot_debian10_linux_args: ""
pxeboot_debian10_nonfree_url: "http://cdimage.debian.org/cdimage/unofficial/non-free/"
-# checksums from version as of 2021-03-22
pxeboot_debian10_nonfree_files:
- - path: "firmware/buster/current"
+ - path: "firmware/buster/20211009"
name: "firmware.cpio.gz"
- checksum: "sha256:f69ffd2202e5aee01b8f500a46daddfb9f787788d4acac5069e6a331d375e721"
+ checksum: "sha256:a9743d56e877888a6984fd52e95192b0f97c908344bdee69c18e072325b8d4e4"
+
+# Debian 11 image
+pxeboot_debian11_base_url: "https://deb.debian.org/debian/dists/bullseye/main/installer-amd64"
+pxeboot_debian11_version: "20210731+deb11u2/images/netboot/debian-installer/amd64/"
+
+# checksums from version as of 2021-11-27
+pxeboot_debian11_files:
+ - name: "linux"
+ checksum: "sha256:0c30db8be595c063eb7a672f0e3aeb1274dc444cd75bf536b0fd01e2cf7066e1"
+ - name: "initrd.gz"
+ checksum: "sha256:c304f5f034996b2200145e3eabf466cbd00ace690944cec01003258abc53d2ce"
+
+pxeboot_debian11_linux_args: ""
+
+pxeboot_debian11_nonfree_url: "http://cdimage.debian.org/cdimage/unofficial/non-free/"
+
+pxeboot_debian11_nonfree_files:
+ - path: "firmware/bullseye/20211218"
+ name: "firmware.cpio.gz"
+ checksum: "sha256:96b98f5bfdf13e0d4434fd12e42cd49b719221a313c8cf9caa4bc9d6e66b3822"
# Ubuntu 18.04 image
pxeboot_ubuntu1804_base_url: "http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64"
-pxeboot_ubuntu1804_version: "20101020ubuntu543.17/images/hwe-netboot/ubuntu-installer/amd64"
+pxeboot_ubuntu1804_version: "20101020ubuntu543.19/images/hwe-netboot/ubuntu-installer/amd64"
+# checksums from version as of 2021-11-27
pxeboot_ubuntu1804_files:
- name: "linux"
- checksum: "sha256:192f8a4357d6aa4d551ea943ec7c947e1f0b3a9a4e3ecd4dc483f8cb1972584e"
+ checksum: "sha256:cf73517963037c823e4fcad52b92c20525071957f85fe9516f0652d38488db3b"
- name: "initrd.gz"
- checksum: "sha256:b09083fd563c183f3ddbe1e28132620f2c5466d49c25c0b8299ae581165d04db"
+ checksum: "sha256:d7609e66d70189ccf4369c3e832d4a8e6a459de28a32b9ab72f1f8eaa82869e3"
pxeboot_ubuntu1804_linux_args: ""
+# Ubuntu 20.04 image
+pxeboot_ubuntu2004_base_url: "http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/installer-amd64"
+pxeboot_ubuntu2004_version: "20101020ubuntu614.3/legacy-images/netboot/ubuntu-installer/amd64"
+
+# checksums from version as of 2021-11-27
+pxeboot_ubuntu2004_files:
+ - name: "linux"
+ checksum: "sha256:cd6e8d6114d11d668aaba86e5e16c24762723d37fa9fd5b309dc1b8a0c2685ef"
+ - name: "initrd.gz"
+ checksum: "sha256:60b10062782ebcbc6b118c2f2bb2163eee9d1e6e6bfc1633a08505e52aab7a56"
+
+pxeboot_ubuntu2004_linux_args: ""
+
+# OpenBSD 7.0 image
+pxeboot_openbsd70_base_url: "https://cdn.openbsd.org/pub/OpenBSD"
+pxeboot_openbsd70_version: "7.0/amd64"
+
+# checksums from version as of 2021-11-27
+pxeboot_openbsd70_files:
+ - name: "cd70.iso"
+ checksum: "sha256:3e3e21b1aa4448cffba103f954b3604c69361ca1fe9a4e15287fc7298171b11f"
+
# preseed config
# this should be replaced with a modular crypt string, or login will not work.
preseed_onfadmin_pw_crypt: "!!"
@@ -67,5 +121,6 @@
# list of hosts
pxeboot_hosts:
- serial: "12345678"
+ mac: "a1:b2:c3:d4:e5:f6"
hostname: "host"
domain: "domain"
diff --git a/meta/main.yml b/meta/main.yml
index 7504fe5..d996ca6 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -5,23 +5,28 @@
# SPDX-License-Identifier: Apache-2.0
galaxy_info:
+ role: pxeboot
+
author: Open Networking Foundation
- description: Configures PXE and iPXE related boot scripts
+ description: Configures a webserver with iPXE related boot scripts and images
company: Open Networking Foundation
issue_tracker_url: https://jira.opennetworking.org/
license: Apache-2.0
- min_ansible_version: 2.9.5
+ min_ansible_version: 2.10.17
platforms:
- - name: Ubuntu
+ - name: ubuntu
versions:
- - "16.04"
- - "18.04"
+ - bionic
+ - name: Debian
+ versions:
+ - bullseye
galaxy_tags:
- pxeboot
+ - ipxe
dependencies: []
diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml
index 7796764..bb22131 100644
--- a/molecule/default/molecule.yml
+++ b/molecule/default/molecule.yml
@@ -14,8 +14,8 @@
privileged: true
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
- - name: "debian-10-priv"
- image: "quay.io/paulfantom/molecule-systemd:debian-10"
+ - name: "debian-11-priv"
+ image: "onfinfra/molecule-systemd:debian-11"
privileged: true
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
@@ -23,7 +23,7 @@
name: ansible
inventory:
host_vars:
- debian-10-priv:
+ debian-11-priv:
ansible_python_interpreter: /usr/bin/python3
ubuntu-18.04-priv:
ansible_python_interpreter: /usr/bin/python3
diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml
index 00ea0fe..975d2dd 100644
--- a/molecule/default/prepare.yml
+++ b/molecule/default/prepare.yml
@@ -21,5 +21,11 @@
apt:
update_cache: true
+ - name: Install ps command for Debian init.d script to function
+ apt:
+ name:
+ - "procps"
+ state: "present"
+
roles:
- nginx
diff --git a/tasks/debian11.yml b/tasks/debian11.yml
new file mode 100644
index 0000000..448003f
--- /dev/null
+++ b/tasks/debian11.yml
@@ -0,0 +1,33 @@
+---
+# pxeboot tasks/debian11.yml
+#
+# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Create debian11 dir in webroot
+ file:
+ state: directory
+ path: "{{ pxeboot_web_root }}/debian11"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0755"
+
+- name: Download debian11 base files
+ get_url:
+ url: "{{ pxeboot_debian11_base_url }}/{{ pxeboot_debian11_version }}/{{ item['name'] }}"
+ dest: "{{ pxeboot_web_root }}/debian11/{{ item['name'] }}"
+ checksum: "{{ item['checksum'] }}"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0644"
+ with_items: "{{ pxeboot_debian11_files }}"
+
+- name: Download debian11 nonfree files
+ get_url:
+ url: "{{ pxeboot_debian11_nonfree_url }}/{{ item['path'] }}/{{ item['name'] }}"
+ dest: "{{ pxeboot_web_root }}/debian11/{{ item['name'] }}"
+ checksum: "{{ item['checksum'] }}"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0644"
+ with_items: "{{ pxeboot_debian11_nonfree_files }}"
diff --git a/tasks/main.yml b/tasks/main.yml
index a261517..f3a8f20 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -26,11 +26,61 @@
group: "{{ pxeboot_groupname }}"
mode: "0755"
-# create boot targets
-- include_tasks: "memtest.yml"
-- include_tasks: "ubuntu1804.yml"
-- include_tasks: "debian10.yml"
+# Download syslinux/memdisk, used by multiple images
+- name: Create utils dir in webroot
+ file:
+ state: directory
+ path: "{{ pxeboot_web_root }}/utils"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0755"
+
+- name: Download syslinux archive (contains memdisk)
+ get_url:
+ url: >
+ https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-{{ pxeboot_syslinux_version }}.zip
+ checksum: "{{ pxeboot_syslinux_checksum }}"
+ dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+ register: syslinux_dl
+
+- name: Create syslinux unarchive dir
+ file:
+ state: directory
+ path: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
+ owner: "root"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0755"
+
+- name: Unarchive syslinux
+ unarchive:
+ remote_src: true
+ src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
+ dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+
+- name: Copy memdisk from syslinux
+ copy:
+ remote_src: true
+ src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}/memdisk/memdisk"
+ dest: "{{ pxeboot_web_root }}/utils/memdisk"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: 0644
+
+# create boot targets
+- name: Include boot images
+ include_tasks: "{{ pxeboot_boot_image }}.yml"
+ loop: "{{ pxeboot_boot_images | flatten(levels=1) }}"
+ loop_control:
+ loop_var: pxeboot_boot_image
+
+# create menu
- name: Create iPXE menu chainboot script from template
template:
src: "boot.ipxe.j2"
diff --git a/tasks/memtest.yml b/tasks/memtest.yml
index 6b9dec3..06c5d80 100644
--- a/tasks/memtest.yml
+++ b/tasks/memtest.yml
@@ -38,40 +38,3 @@
owner: "{{ pxeboot_username }}"
group: "{{ pxeboot_groupname }}"
mode: 0644
-
-- name: Download syslinux archive (contains memdisk)
- get_url:
- url: >
- https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-{{ pxeboot_syslinux_version }}.zip
- checksum: "{{ pxeboot_syslinux_checksum }}"
- dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
- owner: "root"
- group: "root"
- mode: "0644"
- register: syslinux_dl
-
-- name: Create syslinux unarchive dir
- file:
- state: directory
- path: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
- owner: "root"
- group: "{{ pxeboot_groupname }}"
- mode: "0755"
-
-- name: Unarchive syslinux
- unarchive:
- remote_src: true
- src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}.zip"
- dest: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}"
- owner: "root"
- group: "root"
- mode: "0644"
-
-- name: Copy memdisk from syslinux
- copy:
- remote_src: true
- src: "{{ pxeboot_dist_dir }}/syslinux-{{ pxeboot_syslinux_version }}/memdisk/memdisk"
- dest: "{{ pxeboot_web_root }}/memtest/memdisk"
- owner: "{{ pxeboot_username }}"
- group: "{{ pxeboot_groupname }}"
- mode: 0644
diff --git a/tasks/openbsd70.yml b/tasks/openbsd70.yml
new file mode 100644
index 0000000..0979acc
--- /dev/null
+++ b/tasks/openbsd70.yml
@@ -0,0 +1,23 @@
+---
+# pxeboot tasks/openbsd70.yml
+#
+# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Create openbsd70 dir in webroot
+ file:
+ state: directory
+ path: "{{ pxeboot_web_root }}/openbsd70"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0755"
+
+- name: Download OpenBSD 7.0 base files
+ get_url:
+ url: "{{ pxeboot_openbsd70_base_url }}/{{ pxeboot_openbsd70_version }}/{{ item['name'] }}"
+ dest: "{{ pxeboot_web_root }}/openbsd70/{{ item['name'] }}"
+ checksum: "{{ item['checksum'] }}"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0644"
+ with_items: "{{ pxeboot_openbsd70_files }}"
diff --git a/tasks/ubuntu2004.yml b/tasks/ubuntu2004.yml
new file mode 100644
index 0000000..4d60af9
--- /dev/null
+++ b/tasks/ubuntu2004.yml
@@ -0,0 +1,26 @@
+---
+# pxeboot tasks/ubuntu2004.yml
+#
+# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Create ubuntu2004 dir in webroot
+ file:
+ state: directory
+ path: "{{ pxeboot_web_root }}/ubuntu2004"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0755"
+
+- name: Download ubuntu2004 files
+ get_url:
+ url: "{{ pxeboot_ubuntu2004_base_url }}/{{ pxeboot_ubuntu2004_version }}/{{ item['name'] }}"
+ dest: "{{ pxeboot_web_root }}/ubuntu2004/{{ item['name'] }}"
+ checksum: "{{ item['checksum'] }}"
+ owner: "{{ pxeboot_username }}"
+ group: "{{ pxeboot_groupname }}"
+ mode: "0644"
+ with_items: "{{ pxeboot_ubuntu2004_files }}"
+
+# NOTE: Ubuntu 20.04 switched away from using preseed to an autoinstall method
+# https://ubuntu.com/server/docs/install/autoinstall
diff --git a/templates/boot.ipxe.j2 b/templates/boot.ipxe.j2
index 462696a..a654db0 100644
--- a/templates/boot.ipxe.j2
+++ b/templates/boot.ipxe.j2
@@ -20,14 +20,30 @@
item --gap -- DNS Servers: ${net0/dns}, Domain: ${net0/domain}
item --gap -- DHCP Server: ${net0/dhcp-server}
item --gap -- ------------------------- Operating systems ------------------------------
+{% if "debian10" in pxeboot_boot_images %}
item --key d deb10 Debian 10 Installer
item --key f deb10f Debian 10 Installer (nonfree firmware)
+{% endif %}
+{% if "debian11" in pxeboot_boot_images %}
+item --key g deb11 Debian 11 Installer
+item --key h deb11f Debian 11 Installer (nonfree firmware)
+{% endif %}
+{% if "ubuntu1804" in pxeboot_boot_images %}
item --key u ub1804 Ubuntu 18.04 Installer
item --key a ub1804as Ubuntu 18.04 Installer (fully automatic, serial)
-item --key a ub1804am Ubuntu 18.04 Installer (fully automatic, MAC)
+item --key m ub1804am Ubuntu 18.04 Installer (fully automatic, MAC)
item --key t ub1804adt Ubuntu 18.04 Installer (fully automatic, debug, text)
-item --gap -- ------------------------- Utilities --------------------------------------
+{% endif %}
+{% if "ubuntu2004" in pxeboot_boot_images %}
+item --key v ub2004 Ubuntu 20.04 Installer
+{% endif %}
+{% if "openbsd70" in pxeboot_boot_images %}
+item --key o openbsd70 OpenBSD 7.0 Installer
+{% endif %}
+{% if "memtest" in pxeboot_boot_images %}
item --key m memtest Memtest
+{% endif %}
+item --gap -- ------------------------- Utilities --------------------------------------
item --key c configure Configuration Menu
item --key s shell iPXE Shell
item --key r reboot Reboot
@@ -36,7 +52,7 @@
set menu-timeout 0
goto ${selected}
-# other functions
+# Utility functions
:cancel
echo Menu canceled, dropping to iPXE shell
goto shell
@@ -65,14 +81,19 @@
exit
# diagnostics
+{% if "memtest" in pxeboot_boot_images %}
+
+# memtest
:memtest
echo Booting Memtest
-kernel ${http_server_url}/memtest/memdisk
+kernel ${http_server_url}/utils/memdisk
initrd ${http_server_url}/memtest/memtest.iso
imgargs memdisk iso raw
boot || goto failed
+{% endif %}
# installers
+{% if "debian10" in pxeboot_boot_images %}
# Debian 10
:deb10
@@ -88,6 +109,25 @@
initrd ${http_server_url}/debian10/initrd.gz
initrd ${http_server_url}/debian10/firmware.cpio.gz
boot || goto failed
+{% endif %}
+{% if "debian11" in pxeboot_boot_images %}
+
+# Debian 11
+:deb11
+echo Booting Debian 11 Installer
+kernel ${http_server_url}/debian11/linux
+initrd ${http_server_url}/debian11/initrd.gz
+boot || goto failed
+
+# Debian 11 with nonfree firmware
+:deb11f
+echo Booting Debian 11 Installer with nonfree firmware
+kernel ${http_server_url}/debian11/linux initrd=initrd.gz initrd=firmware.cpio.gz
+initrd ${http_server_url}/debian11/initrd.gz
+initrd ${http_server_url}/debian11/firmware.cpio.gz
+boot || goto failed
+{% endif %}
+{% if "ubuntu1804" in pxeboot_boot_images %}
# Ubuntu 18.04
:ub1804
@@ -113,6 +153,7 @@
initrd ${http_server_url}/ubuntu1804/initrd.gz
initrd ${http_server_url}/ubuntu1804/${net0/mac}_preseed.cfg preseed.cfg
boot || goto failed
+{% if pxeboot_image_debug %}
# Ubuntu 18.04 autoinstall, text-mode, debug
:ub1804adt
@@ -121,3 +162,24 @@
initrd ${http_server_url}/ubuntu1804/initrd.gz
initrd ${http_server_url}/ubuntu1804/${serial}_preseed.cfg preseed.cfg
boot || goto failed
+{% endif %}
+{% endif %}
+{% if "ubuntu2004" in pxeboot_boot_images %}
+
+# Ubuntu 18.04
+:ub2004
+echo Booting Ubuntu 20.04 Installer
+kernel ${http_server_url}/ubuntu2004/linux
+initrd ${http_server_url}/ubuntu2004/initrd.gz
+boot || goto failed
+{% endif %}
+{% if "openbsd70" in pxeboot_boot_images %}
+
+# OpenBSD 7.0
+:openbsd70
+echo Booting OpenBSD 7.0
+kernel ${http_server_url}/utils/memdisk
+initrd ${http_server_url}/openbsd70/cd70.iso
+imgargs memdisk iso raw
+boot || goto failed
+{% endif %}