From bc611698c89b58e202337c6789b8cf0bad91332b Mon Sep 17 00:00:00 2001 From: Antony Messerli Date: Mon, 12 Mar 2018 11:54:31 -0500 Subject: [PATCH] Adds iPXE UEFI support to Multi Node AIO Now expects a base URL that looks for iPXE files. Uses boot.ipxe.org by default but the base URL can be overridden to point to custom compiled versions of ipxe.lkrn, ipxe.efi, and undionly.kpxe. Change-Id: Ib2c10c4817eaf9a78326f3de00aed0c16f8df776 --- multi-node-aio/README.rst | 4 +- multi-node-aio/build.sh | 2 +- multi-node-aio/playbooks/deploy-pxe.yml | 8 ++- multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 | 58 ++++++++++++++++++- multi-node-aio/playbooks/group_vars/all.yml | 2 +- .../playbooks/pxe/tftp/boot.ipxe.j2 | 4 +- 6 files changed, 69 insertions(+), 9 deletions(-) diff --git a/multi-node-aio/README.rst b/multi-node-aio/README.rst index 2b401028..fd90a9d3 100644 --- a/multi-node-aio/README.rst +++ b/multi-node-aio/README.rst @@ -170,8 +170,8 @@ Instruct the system to use a set amount of ram for the logging VM type: Instruct the system to use a set amount of ram for the swift VM type: ``SWIFT_VM_SERVER_RAM=${SWIFT_VM_SERVER_RAM:-1024}`` -Instruct the system to use a customized iPXE kernel: - ``IPXE_KERNEL_URL=${IPXE_KERNEL_URL:-'http://boot.ipxe.org/ipxe.lkrn'}`` +Instruct the system where to obtain iPXE kernels (looks for ipxe.lkrn, ipxe.efi, etc): + ``IPXE_KERNEL_BASE_URL=${IPXE_KERNEL_BASE_URL:-'http://boot.ipxe.org'}`` Instruct the system to use a customized iPXE script during boot of VMs: ``IPXE_PATH_URL=${IPXE_PATH_URL:-''}`` diff --git a/multi-node-aio/build.sh b/multi-node-aio/build.sh index 4c1d4cc9..33f9a4e2 100755 --- a/multi-node-aio/build.sh +++ b/multi-node-aio/build.sh @@ -52,7 +52,7 @@ ansible-playbook -vv \ -e logging_vm_server_ram=${LOGGING_VM_SERVER_RAM:-"1024"} \ -e swift_vm_server_ram=${SWIFT_VM_SERVER_RAM:-"1024"} \ -e container_tech=${CONTAINER_TECH:-"lxc"} \ - -e ipxe_kernel_url=${IPXE_KERNEL_URL:-"http://boot.ipxe.org/ipxe.lkrn"} \ + -e ipxe_kernel_base_url=${IPXE_KERNEL_BASE_URL:-"http://boot.ipxe.org"} \ -e ipxe_path_url=${IPXE_PATH_URL:-""} ${MNAIO_ANSIBLE_PARAMETERS} \ --force-handlers \ playbooks/site.yml diff --git a/multi-node-aio/playbooks/deploy-pxe.yml b/multi-node-aio/playbooks/deploy-pxe.yml index 0058e75e..e865c228 100644 --- a/multi-node-aio/playbooks/deploy-pxe.yml +++ b/multi-node-aio/playbooks/deploy-pxe.yml @@ -89,9 +89,13 @@ - name: Download iPXE get_url: - url: "{{ ipxe_kernel_url }}" - dest: "/var/lib/tftpboot/ipxe.lkrn" + url: "{{ ipxe_kernel_base_url }}/{{ item.filename }}" + dest: "/var/lib/tftpboot/{{ item.dest }}" tmp_dest: /tmp/ + with_items: + - { filename: 'ipxe.lkrn', dest: 'ipxe.lkrn' } + - { filename: 'ipxe.efi', dest: 'ipxe.efi' } + - { filename: 'undionly.kpxe', dest: 'undionly.kpxe' } - name: Drop ipxe default menu template: diff --git a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 index ab2d9f94..7ec87af0 100644 --- a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 +++ b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 @@ -6,6 +6,58 @@ allow bootp; log-facility local7; authoritative; +# Declare the iPXE option space +option space ipxe; +option ipxe-encap-opts code 175 = encapsulate ipxe; + +# iPXE options, can be set in DHCP response packet +option ipxe.priority code 1 = signed integer 8; +option ipxe.keep-san code 8 = unsigned integer 8; +option ipxe.skip-san-boot code 9 = unsigned integer 8; +option ipxe.syslogs code 85 = string; +option ipxe.cert code 91 = string; +option ipxe.privkey code 92 = string; +option ipxe.crosscert code 93 = string; +option ipxe.no-pxedhcp code 176 = unsigned integer 8; +option ipxe.bus-id code 177 = string; +option ipxe.san-filename code 188 = string; +option ipxe.bios-drive code 189 = unsigned integer 8; +option ipxe.username code 190 = string; +option ipxe.password code 191 = string; +option ipxe.reverse-username code 192 = string; +option ipxe.reverse-password code 193 = string; +option ipxe.version code 235 = string; +option iscsi-initiator-iqn code 203 = string; + +# iPXE feature flags, set in DHCP request packet +option ipxe.pxeext code 16 = unsigned integer 8; +option ipxe.iscsi code 17 = unsigned integer 8; +option ipxe.aoe code 18 = unsigned integer 8; +option ipxe.http code 19 = unsigned integer 8; +option ipxe.https code 20 = unsigned integer 8; +option ipxe.tftp code 21 = unsigned integer 8; +option ipxe.ftp code 22 = unsigned integer 8; +option ipxe.dns code 23 = unsigned integer 8; +option ipxe.bzimage code 24 = unsigned integer 8; +option ipxe.multiboot code 25 = unsigned integer 8; +option ipxe.slam code 26 = unsigned integer 8; +option ipxe.srp code 27 = unsigned integer 8; +option ipxe.nbi code 32 = unsigned integer 8; +option ipxe.pxe code 33 = unsigned integer 8; +option ipxe.elf code 34 = unsigned integer 8; +option ipxe.comboot code 35 = unsigned integer 8; +option ipxe.efi code 36 = unsigned integer 8; +option ipxe.fcoe code 37 = unsigned integer 8; +option ipxe.vlan code 38 = unsigned integer 8; +option ipxe.menu code 39 = unsigned integer 8; +option ipxe.sdi code 40 = unsigned integer 8; +option ipxe.nfs code 41 = unsigned integer 8; + +# Other useful general options +option arch code 93 = unsigned integer 16; +option client-architecture code 93 = unsigned integer 16; +option conf-file code 209 = text; + shared-network all-networks { {% for dhcp in dhcp_list %} subnet {{ dhcp.subnet }} netmask {{ dhcp.netmask }} { @@ -33,8 +85,12 @@ shared-network all-networks { {% elif ipxe_boot_file is defined and ipxe_boot_file|length > 0 %} filename "{{ ipxe_boot_file }}"; {% endif %} + } elsif option arch = 00:07 { + filename "ipxe.efi"; + } elsif option arch = 00:00 { + filename "ipxe.lkrn"; } else { - filename "ipxe.lkrn"; + filename "undionly.kpxe"; } } diff --git a/multi-node-aio/playbooks/group_vars/all.yml b/multi-node-aio/playbooks/group_vars/all.yml index a207c475..ae277914 100644 --- a/multi-node-aio/playbooks/group_vars/all.yml +++ b/multi-node-aio/playbooks/group_vars/all.yml @@ -28,7 +28,7 @@ default_ubuntu_mirror_directory: /ubuntu default_container_tech: "{{ container_tech | default('lxc') }}" -ipxe_kernel_url: "http://boot.ipxe.org/ipxe.lkrn" +ipxe_kernel_base_url: "http://boot.ipxe.org" # IP address, or domain name of the TFTP server tftp_server: "{{ hostvars[groups['pxe_hosts'][0]]['ansible_host'] | default(ansible_host) }}" diff --git a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 index 516a02c9..5ea9e442 100644 --- a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 +++ b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 @@ -6,8 +6,8 @@ set space:hex 20:20 set space ${space:string} set timeout 10 -{% if ipxe_kernel_url is defined and ipxe_kernel_url|length > 0%} -iseq ${version} {{ ipxe_ubuntu_version }} && chain --autofree {{ ipxe_kernel_url }} || +{% if ipxe_kernel_base_url is defined and ipxe_kernel_base_url|length > 0%} +iseq ${version} {{ ipxe_ubuntu_version }} && chain --autofree {{ ipxe_kernel_base_url }}/ipxe.lkrn || {% else %} iseq ${version} {{ ipxe_ubuntu_version }} && chain --autofree ipxe.lkrn || {% endif %}