소스 검색

Adding more changes

Antony Messerli 5 년 전
부모
커밋
fe57e98664
33개의 변경된 파일683개의 추가작업 그리고 189개의 파일을 삭제
  1. 1 1
      TODO.md
  2. 20 4
      roles/netbootxyz/defaults/main.yml
  3. 67 0
      roles/netbootxyz/files/ipxe/disks/netboot.xyz
  4. 68 0
      roles/netbootxyz/files/ipxe/disks/netboot.xyz-gce
  5. 69 0
      roles/netbootxyz/files/ipxe/disks/netboot.xyz-packet
  6. 28 0
      roles/netbootxyz/files/ipxe/local/colour.h
  7. 1 0
      roles/netbootxyz/files/ipxe/local/crypto.h
  8. 11 0
      roles/netbootxyz/files/ipxe/local/general.h
  9. 10 0
      roles/netbootxyz/files/ipxe/local/general.h.efi
  10. 4 0
      roles/netbootxyz/files/ipxe/local/nap.h.efi
  11. 2 0
      roles/netbootxyz/files/ipxe/local/usb.h.efi
  12. 7 132
      roles/netbootxyz/tasks/generate_disks.yml
  13. 0 0
      roles/netbootxyz/tasks/generate_disks_arm.yml
  14. 66 0
      roles/netbootxyz/tasks/generate_disks_base.yml
  15. 44 0
      roles/netbootxyz/tasks/generate_disks_efi.yml
  16. 36 0
      roles/netbootxyz/tasks/generate_disks_legacy.yml
  17. 6 2
      roles/netbootxyz/tasks/generate_menus.yml
  18. 6 2
      roles/netbootxyz/templates/disks/ipxe-bootloader.j2
  19. 5 5
      roles/netbootxyz/templates/menu/boot.cfg.j2
  20. 2 2
      roles/netbootxyz/templates/menu/bsd.ipxe.j2
  21. 32 0
      roles/netbootxyz/templates/menu/gentoo.ipxe.j2
  22. 0 7
      roles/netbootxyz/templates/menu/index.html
  23. 11 0
      roles/netbootxyz/templates/menu/index.html.j2
  24. 1 1
      roles/netbootxyz/templates/menu/linux.ipxe.j2
  25. 1 1
      roles/netbootxyz/templates/menu/live.ipxe.j2
  26. 19 4
      roles/netbootxyz/templates/menu/liveubuntu-default.ipxe.j2
  27. 0 26
      roles/netbootxyz/templates/menu/liveubuntu.ipxe.j2
  28. 44 0
      roles/netbootxyz/templates/menu/mageia.ipxe.j2
  29. 1 1
      roles/netbootxyz/templates/menu/menu.ipxe.j2
  30. 52 0
      roles/netbootxyz/templates/menu/rhel.ipxe.j2
  31. 59 0
      roles/netbootxyz/templates/menu/windows.ipxe.j2
  32. 5 0
      roles/netbootxyz/vars/ubuntu.yml
  33. 5 1
      user_overrides.yml

+ 1 - 1
TODO.md

@@ -9,4 +9,4 @@
 * More host OS support
 * Docker images
 * package cacher
-* port netboot.xyz to this in staging env to validate and test
+* port netboot.xyz to this in staging env to validate and test

+ 20 - 4
roles/netbootxyz/defaults/main.yml

@@ -1,17 +1,27 @@
 ---
 
+### site configuration ###
 site_name: netboot.xyz
 boot_domain: boot.netboot.xyz
 boot_version: 1.04
 
+sigs_enabled: false
+img_sigs_enabled: false
+sigs_location: "http://${boot_domain}/sigs/"
+memdisk_location: "http://${boot_domain}/memdisk"
+
 ipxe_repo: https://github.com/ipxe/ipxe.git
 ipxe_branch: master
 ipxe_source_dir: /usr/src/ipxe
 
-netbootxyz_repo: https://github.com/netbootxyz/netboot.xyz.git
-netbootxyz_branch: master
+live_endpoint: "https://github.com/netbootxyz"
 netbootxyz_root: /var/www/html
 
+bootloader_tftp_enabled: false
+bootloader_https_enabled: true
+bootloader_http_enabled: true
+
+### release values ###
 releases:
   alpinelinux:
     name: "Alpine Linux"
@@ -126,6 +136,7 @@ releases:
         code_name: "edge"
   freebsd:
     name: "FreeBSD"
+    enabled: false
     menu: "bsd"
     versions:
       - name: "FreeBSD 12.0"
@@ -157,14 +168,16 @@ releases:
   gentoo:
     name: "Gentoo"
     mirror: ""
+    enabled: false
     menu: "linux"
     versions:
-      - name: "TBA"
-        code_name: "TBA"
+      - name: "Minimal CD 20160204 (amd64)"
+        code_name: "20160204"
   ipfire:
     name: "IPFire"
     mirror: "downloads.ipfire.org"
     menu: "linux"
+    enabled: true
     versions:
       - name: "2.21 Core 126"
         code_name: "2.21-core126"
@@ -301,6 +314,7 @@ releases:
     name: "Scientific Linux"
     mirror: "ftp1.scientificlinux.org"
     base_dir: ""
+    enabled: true
     menu: "linux"
     versions:
       - name: "7.7"
@@ -315,6 +329,7 @@ releases:
     name: "Slackware"
     mirror: "mirror.rackspace.com"
     base_dir: "slackware"
+    enabled: true
     menu: "linux"
     versions:
       - name: "Current"
@@ -326,6 +341,7 @@ releases:
   tinycore:
     name: "Tiny Core Linux"
     mirror: "tinycorelinux.net"
+    enabled: true
     menu: "linux"
     versions:
       - name: "Core [ISO]"

+ 67 - 0
roles/netbootxyz/files/ipxe/disks/netboot.xyz

@@ -0,0 +1,67 @@
+#!ipxe
+set esc:hex 1b
+set bold ${esc:string}[1m
+set boldoff ${esc:string}[22m
+set fg_gre ${esc:string}[32m
+set fg_cya ${esc:string}[36m
+set fg_whi ${esc:string}[37m
+set HTTPS_ERR HTTPS appears to have failed... attempting HTTP
+set HTTP_ERR HTTP has failed, localbooting...
+set version 1.04
+
+:start
+echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version}${boldoff}
+prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
+
+:dhcp
+echo
+dhcp || goto netconfig
+goto menu
+
+:failsafe
+menu netboot.xyz Failsafe Menu
+item localboot Boot to local drive
+item netconfig Manual network configuration
+item retry Retry boot
+item debug iPXE Debug Shell
+item reboot Reboot System
+choose failsafe_choice || exit
+goto ${failsafe_choice}
+
+:netconfig
+echo Network Configuration:
+echo Available interfaces...
+ifstat
+imgfree
+echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
+isset ${net} || set net 0
+echo -n IP: && read net${net}/ip
+echo -n Subnet mask: && read net${net}/netmask
+echo -n Gateway: && read net${net}/gateway
+echo -n DNS: && read dns
+ifopen net${net}
+echo Attempting chainload of netboot.xyz...
+goto menu || goto failsafe
+
+:menu
+set conn_type https
+chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
+sleep 5
+set conn_type http
+chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
+goto localboot
+
+:localboot
+exit
+
+:retry
+goto start
+
+:reboot
+reboot
+goto start
+
+:debug
+echo Type "exit" to return to menu
+shell
+goto failsafe

+ 68 - 0
roles/netbootxyz/files/ipxe/disks/netboot.xyz-gce

@@ -0,0 +1,68 @@
+#!ipxe
+set esc:hex 1b
+set bold ${esc:string}[1m
+set boldoff ${esc:string}[22m
+set fg_gre ${esc:string}[32m
+set fg_cya ${esc:string}[36m
+set fg_whi ${esc:string}[37m
+set HTTPS_ERR HTTPS appears to have failed... attempting HTTP
+set HTTP_ERR HTTP has failed, localbooting...
+set version 1.04
+set ipxe_cloud_config gce
+
+:start
+echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_cya}Google Compute Engine${boldoff}
+prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
+
+:dhcp
+echo
+dhcp || goto netconfig
+goto menu
+
+:failsafe
+menu netboot.xyz Failsafe Menu
+item localboot Boot to local drive
+item netconfig Manual network configuration
+item retry Retry boot
+item debug iPXE Debug Shell
+item reboot Reboot System
+choose failsafe_choice || exit
+goto ${failsafe_choice}
+
+:netconfig
+echo Network Configuration:
+echo Available interfaces...
+ifstat
+imgfree
+echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
+isset ${net} || set net 0
+echo -n IP: && read net${net}/ip
+echo -n Subnet mask: && read net${net}/netmask
+echo -n Gateway: && read net${net}/gateway
+echo -n DNS: && read dns
+ifopen net${net}
+echo Attempting chainload of netboot.xyz...
+goto menu || goto failsafe
+
+:menu
+set conn_type https
+chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
+sleep 5
+set conn_type http
+chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
+goto localboot
+
+:localboot
+exit
+
+:retry
+goto start
+
+:reboot
+reboot
+goto start
+
+:debug
+echo Type "exit" to return to menu
+shell
+goto failsafe

+ 69 - 0
roles/netbootxyz/files/ipxe/disks/netboot.xyz-packet

@@ -0,0 +1,69 @@
+#!ipxe
+set esc:hex 1b
+set bold ${esc:string}[1m
+set boldoff ${esc:string}[22m
+set fg_gre ${esc:string}[32m
+set fg_red ${esc:string}[31m
+set fg_cya ${esc:string}[36m
+set fg_whi ${esc:string}[37m
+set HTTPS_ERR HTTPS appears to have failed... attempting HTTP
+set HTTP_ERR HTTP has failed, localbooting...
+set version 1.04
+set ipxe_cloud_config packet
+
+:start
+echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_red}packet.com${fg_whi}${boldoff}
+prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
+
+:dhcp
+echo
+dhcp || goto netconfig
+goto menu
+
+:failsafe
+menu netboot.xyz Failsafe Menu
+item localboot Boot to local drive
+item netconfig Manual network configuration
+item retry Retry boot
+item debug iPXE Debug Shell
+item reboot Reboot System
+choose failsafe_choice || exit
+goto ${failsafe_choice}
+
+:netconfig
+echo Network Configuration:
+echo Available interfaces...
+ifstat
+imgfree
+echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
+isset ${net} || set net 0
+echo -n IP: && read net${net}/ip
+echo -n Subnet mask: && read net${net}/netmask
+echo -n Gateway: && read net${net}/gateway
+echo -n DNS: && read dns
+ifopen net${net}
+echo Attempting chainload of netboot.xyz...
+goto menu || goto failsafe
+
+:menu
+set conn_type https
+chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
+sleep 5
+set conn_type http
+chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
+goto localboot
+
+:localboot
+exit
+
+:retry
+goto start
+
+:reboot
+reboot
+goto start
+
+:debug
+echo Type "exit" to return to menu
+shell
+goto failsafe

+ 28 - 0
roles/netbootxyz/files/ipxe/local/colour.h

@@ -0,0 +1,28 @@
+#undef COLOR_NORMAL_FG
+#undef COLOR_NORMAL_BG
+#undef COLOR_SELECT_FG
+#undef COLOR_SELECT_BG
+#undef COLOR_SEPARATOR_FG
+#undef COLOR_SEPARATOR_BG
+#undef COLOR_EDIT_FG
+#undef COLOR_EDIT_BG
+#undef COLOR_ALERT_FG
+#undef COLOR_ALERT_BG
+#undef COLOR_URL_FG
+#undef COLOR_URL_BG
+#undef COLOR_PXE_FG
+#undef COLOR_PXE_BG
+#define COLOR_NORMAL_FG		COLOR_CYAN
+#define COLOR_NORMAL_BG		COLOR_BLACK
+#define COLOR_SELECT_FG		COLOR_WHITE
+#define COLOR_SELECT_BG		COLOR_BLUE
+#define COLOR_SEPARATOR_FG	COLOR_WHITE
+#define COLOR_SEPARATOR_BG	COLOR_BLACK
+#define COLOR_EDIT_FG		COLOR_BLACK
+#define COLOR_EDIT_BG		COLOR_CYAN
+#define COLOR_ALERT_FG		COLOR_WHITE
+#define COLOR_ALERT_BG		COLOR_RED
+#define COLOR_URL_FG		COLOR_CYAN
+#define COLOR_URL_BG		COLOR_BLUE
+#define COLOR_PXE_FG		COLOR_BLACK
+#define COLOR_PXE_BG		COLOR_WHITE

+ 1 - 0
roles/netbootxyz/files/ipxe/local/crypto.h

@@ -0,0 +1 @@
+#undef OCSP_CHECK

+ 11 - 0
roles/netbootxyz/files/ipxe/local/general.h

@@ -0,0 +1,11 @@
+#define DIGEST_CMD            /* Image crypto digest commands */
+#define DOWNLOAD_PROTO_HTTPS  /* Secure Hypertext Transfer Protocol */      
+#define IMAGE_COMBOOT         /* COMBOOT */
+#define IMAGE_TRUST_CMD	      /* Image trust management commands */
+#define NET_PROTO_IPV6        /* IPv6 protocol */
+#define NSLOOKUP_CMD          /* DNS resolving command */
+#define NTP_CMD               /* NTP commands */
+#define PCI_CMD               /* PCI commands */
+#define REBOOT_CMD            /* Reboot command */
+#define TIME_CMD              /* Time commands */
+#define VLAN_CMD              /* VLAN commands */

+ 10 - 0
roles/netbootxyz/files/ipxe/local/general.h.efi

@@ -0,0 +1,10 @@
+#define DIGEST_CMD            /* Image crypto digest commands */
+#define DOWNLOAD_PROTO_HTTPS  /* Secure Hypertext Transfer Protocol */      
+#define IMAGE_TRUST_CMD	      /* Image trust management commands */
+#define NET_PROTO_IPV6        /* IPv6 protocol */
+#define NSLOOKUP_CMD          /* DNS resolving command */
+#define NTP_CMD               /* NTP commands */
+#define PCI_CMD               /* PCI commands */
+#define REBOOT_CMD            /* Reboot command */
+#define TIME_CMD              /* Time commands */
+#define VLAN_CMD              /* VLAN commands */

+ 4 - 0
roles/netbootxyz/files/ipxe/local/nap.h.efi

@@ -0,0 +1,4 @@
+/* nap.h */
+#undef NAP_EFIX86
+#undef NAP_EFIARM
+#define NAP_NULL

+ 2 - 0
roles/netbootxyz/files/ipxe/local/usb.h.efi

@@ -0,0 +1,2 @@
+/* usb.h */
+#define	USB_EFI	

+ 7 - 132
roles/netbootxyz/tasks/generate_disks.yml

@@ -1,136 +1,11 @@
 ---
-  - name: Adds python packages if python is not present
-    raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal python-yaml)
 
-  - name: Gathering facts
-    setup:
+  - include: generate_disks_base.yml
 
-  - name: Gather variables for each operating system
-    include_vars: "{{ item }}"
-    with_first_found:
-      - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
-      - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
-      - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
-      - "{{ ansible_distribution | lower }}.yml"
-      - "{{ ansible_os_family | lower }}.yml"
+  - include: generate_disks_legacy.yml
+    when:
+    - generate_disks_legacy | default(true) | bool
 
-  - name: Install required packages
-    package:
-      name: "{{ item }}"
-      state: latest
-    with_items: "{{ netbootxyz_packages }}"
-
-  - name: Check out latest iPXE sources
-    git:
-      repo: "{{ ipxe_repo }}"
-      dest: /usr/src/ipxe
-      version: "{{ ipxe_branch }}"
-
-  - name: Check out latest netboot.xyz sources
-    git:
-      repo: "{{ netbootxyz_repo }}"
-      dest: /usr/src/netboot.xyz
-      version: "{{ netbootxyz_branch }}"
-
-  - name: Copy iPXE Bootloader template to iPXE source directory
-    template:
-      src: disks/ipxe-bootloader.j2
-      dest: /usr/src/ipxe/src/ipxe-bootloader
-
-  - name: Copy netboot.xyz colour.h iPXE config
-    file:
-      src: /usr/src/netboot.xyz/ipxe/local/colour.h
-      dest: /usr/src/ipxe/src/config/local/colour.h
-      state: link
-
-  - name: Copy netboot.xyz general.h iPXE config
-    file:
-      src: /usr/src/netboot.xyz/ipxe/local/general.h
-      dest: /usr/src/ipxe/src/config/local/general.h
-      state: link
-
-  - name: Touch iPXE config local files
-    file:
-      path: "{{ item }}"
-      state: touch
-    with_items:
-    - /usr/src/ipxe/src/config/local/console.h
-    - /usr/src/ipxe/src/config/local/umalloc.h
-    - /usr/src/ipxe/src/config/local/nap.h
-    - /usr/src/ipxe/src/config/local/timer.h
-    - /usr/src/ipxe/src/config/local/branding.h
-    - /usr/src/ipxe/src/config/local/serial.h
-    - /usr/src/ipxe/src/config/local/reboot.h
-    - /usr/src/ipxe/src/config/local/sanboot.h
-    - /usr/src/ipxe/src/config/local/fault.h
-    - /usr/src/ipxe/src/config/local/dhcp.h
-    - /usr/src/ipxe/src/config/local/sideband.h
-    - /usr/src/ipxe/src/config/local/entropy.h
-    - /usr/src/ipxe/src/config/local/crypto.h
-    - /usr/src/ipxe/src/config/local/usb.h
-    - /usr/src/ipxe/src/config/local/settings.h
-
-  - name: Create iPXE file directory
-    file:
-      path: /var/www/html/ipxe
-      state: directory
-
-  - name: Compile iPXE bootloader for Legacy BIOS
-    shell: "{{ item }}"
-    with_items:
-    - make EMBED=ipxe-bootloader bin/ipxe.dsk bin/ipxe.iso bin/ipxe.lkrn bin/ipxe.usb bin/ipxe.kpxe bin/undionly.kpxe
-    args:
-      chdir: /usr/src/ipxe/src
-
-  - name: Copy iPXE files for Legacy BIOS to http directory
-    copy:
-      src: /usr/src/ipxe/src/bin/{{ item }}
-      dest: /var/www/html/ipxe/{{ boot_domain }}-{{ item }}
-      remote_src: True
-    with_items:
-    - ipxe.dsk
-    - ipxe.iso
-    - ipxe.lkrn
-    - ipxe.usb
-    - ipxe.kpxe
-    - undionly.kpxe
-
-  - name: Copy helper apps
-    copy:
-      src: "{{ item }}"
-      dest: "{{ netbootxyz_root }}"
-    with_items:
-      - memdisk
-      - wimboot
-
-  - name: Copy netboot.xyz general.h.efi iPXE config
-    file:
-      src: /usr/src/netboot.xyz/ipxe/local/general.h.efi
-      dest: /usr/src/ipxe/src/config/local/general.h
-      state: link
-
-  - name: Compile iPXE bootloader for EFI
-    shell: "{{ item }}"
-    with_items:
-    - make clean
-    - make EMBED=ipxe-bootloader bin-x86_64-efi/ipxe.efi
-    args:
-      chdir: /usr/src/ipxe/src
-
-  - name: Generate iPXE EFI ISO Disk
-    shell: "{{ item }}"
-    with_items:
-    - mkdir -p efi_tmp/EFI/BOOT/
-    - cp bin-x86_64-efi/ipxe.efi efi_tmp/EFI/BOOT/bootx64.efi
-    - genisoimage -o ipxe-efi.iso efi_tmp
-    args:
-      chdir: /usr/src/ipxe/src
-
-  - name: Copy iPXE EFI builds to http directory
-    copy:
-      src: "{{ ipxe_source_dir }}/src/{{ item.src }}"
-      dest: "{{ netbootxyz_root }}/ipxe/{{ item.dest }}"
-      remote_src: True
-    with_items:
-      - { src: "bin-x86_64-efi/ipxe.efi", dest: "{{ boot_domain }}-ipxe.efi" }
-      - { src: "ipxe-efi.iso", dest: "{{ boot_domain }}-ipxe-efi.iso" }
+  - include: generate_disks_efi.yml
+    when:
+    - generate_disks_efi | default(true) | bool

+ 0 - 0
roles/netbootxyz/tasks/generate_disks_arm.yml


+ 66 - 0
roles/netbootxyz/tasks/generate_disks_base.yml

@@ -0,0 +1,66 @@
+---
+
+  - name: Gathering facts
+    setup:
+
+  - name: Gather variables for each operating system
+    include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
+      - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
+      - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
+      - "{{ ansible_distribution | lower }}.yml"
+      - "{{ ansible_os_family | lower }}.yml"
+
+  - name: Create iPXE file directories
+    file:
+      path: "{{ item }}"
+      state: directory
+    with_items:
+      - "{{ netbootxyz_root }}/ipxe"
+
+  - name: Copy helper apps
+    copy:
+      src: "{{ item }}"
+      dest: "{{ netbootxyz_root }}"
+    with_items:
+      - memdisk
+      - wimboot
+
+  - name: Install required packages
+    package:
+      name: "{{ item }}"
+      state: latest
+    with_items: "{{ netbootxyz_packages }}"
+
+  - name: Check out latest iPXE sources
+    git:
+      repo: "{{ ipxe_repo }}"
+      dest: "{{ ipxe_source_dir }}"
+      version: "{{ ipxe_branch }}"
+
+  - name: Copy iPXE Bootloader template to iPXE source directory
+    template:
+      src: disks/ipxe-bootloader.j2
+      dest: "{{ ipxe_source_dir }}/src/ipxe-bootloader"
+
+  - name: Touch iPXE config local files
+    file:
+      path: "{{ ipxe_source_dir }}/{{ item }}"
+      state: touch
+    with_items:
+      - src/config/local/console.h
+      - src/config/local/umalloc.h
+      - src/config/local/nap.h
+      - src/config/local/timer.h
+      - src/config/local/branding.h
+      - src/config/local/serial.h
+      - src/config/local/reboot.h
+      - src/config/local/sanboot.h
+      - src/config/local/fault.h
+      - src/config/local/dhcp.h
+      - src/config/local/sideband.h
+      - src/config/local/entropy.h
+      - src/config/local/crypto.h
+      - src/config/local/usb.h
+      - src/config/local/settings.h

+ 44 - 0
roles/netbootxyz/tasks/generate_disks_efi.yml

@@ -0,0 +1,44 @@
+---
+
+  - name: Copy netboot.xyz local EFI iPXE configs
+    copy:
+      src: "ipxe/local/{{ item }}"
+      dest: "{{ ipxe_source_dir }}/src/config/local/{{ item }}"
+    with_items:
+      - colour.h
+      - crypto.h
+
+  - name: Copy netboot.xyz general.h.efi iPXE config
+    copy:
+      src: "ipxe/local/general.h.efi"
+      dest: "{{ ipxe_source_dir }}/src/config/local/general.h"
+
+  - name: Compile iPXE bootloader for EFI
+    shell: "{{ item }}"
+    with_items:
+    - make clean
+    - make EMBED=ipxe-bootloader bin-x86_64-efi/ipxe.efi
+    args:
+      chdir: "{{ ipxe_source_dir }}/src"
+
+  - name: Generate iPXE EFI ISO Disk
+    shell: "{{ item }}"
+    with_items:
+      - mkdir -p efi_tmp
+      - dd if=/dev/zero of=efi_tmp/ipxe.img count=2880
+      - mformat -i efi_tmp/ipxe.img -m 0xf8 -f 2880
+      - mmd -i efi_tmp/ipxe.img ::efi ::efi/boot
+      - mcopy -i efi_tmp/ipxe.img bin-x86_64-efi/ipxe.efi ::efi/boot/bootx64.efi
+      - genisoimage -o ipxe-efi.eiso -eltorito-alt-boot -e ipxe.img -no-emul-boot efi_tmp
+    args:
+      chdir: "{{ ipxe_source_dir }}/src"
+      warn: false
+
+  - name: Copy iPXE EFI builds to http directory
+    copy:
+      src: "{{ ipxe_source_dir }}/src/{{ item.src }}"
+      dest: "{{ netbootxyz_root }}/ipxe/{{ item.dest }}"
+      remote_src: True
+    with_items:
+      - { src: "bin-x86_64-efi/ipxe.efi", dest: "{{ site_name }}.efi" }
+      - { src: "ipxe-efi.eiso", dest: "{{ site_name }}-efi.iso" }

+ 36 - 0
roles/netbootxyz/tasks/generate_disks_legacy.yml

@@ -0,0 +1,36 @@
+---
+
+  - name: Copy netboot.xyz local legacy iPXE configs
+    copy:
+      src: "ipxe/local/{{ item }}"
+      dest: "{{ ipxe_source_dir }}/src/config/local/{{ item }}"
+    with_items:
+      - colour.h
+      - crypto.h
+      - general.h
+
+  - name: Compile iPXE bootloader for Legacy BIOS
+    shell: "{{ item }}"
+    with_items:
+    - make clean
+    - make EMBED=ipxe-bootloader bin/ipxe.dsk bin/ipxe.iso bin/ipxe.lkrn bin/ipxe.usb bin/ipxe.kpxe bin/undionly.kpxe
+    args:
+      chdir: "{{ ipxe_source_dir }}/src"
+
+  - name: Copy iPXE files for Legacy BIOS to http directory
+    copy:
+      src: "{{ ipxe_source_dir }}/src/bin/ipxe{{ item }}"
+      dest: "{{ netbootxyz_root }}/ipxe/{{ site_name }}{{ item }}"
+      remote_src: True
+    with_items:
+    - ".dsk"
+    - ".iso"
+    - ".lkrn"
+    - ".usb"
+    - ".kpxe"
+
+  - name: Copy undionly.kpxe for Legacy BIOS to http directory
+    copy:
+      src: "{{ ipxe_source_dir }}/src/bin/undionly.kpxe"
+      dest: "{{ netbootxyz_root }}/ipxe/{{ site_name }}-undionly.kpxe"
+      remote_src: True

+ 6 - 2
roles/netbootxyz/tasks/generate_menus.yml

@@ -1,11 +1,11 @@
 ---
   - name: Combine overrides with defaults
     set_fact: 
-      _my_releases: "{{ releases|combine(release_overrides, recursive=True) }}"
+      _releases: "{{ releases|combine(release_overrides, recursive=True) }}"
 
   - name: Set releases with user overrides
     set_fact:
-      releases: "{{ _my_releases }}"
+      releases: "{{ _releases }}"
 
   - name: Generate directories
     file:
@@ -16,6 +16,10 @@
     debug:
       var: releases
 
+  - name: Dump endpoint vars for debugging
+    debug:
+      var: endpoints
+
   - name: Generate netboot.xyz source files templates
     template:
       src: "{{ item.src }}"

+ 6 - 2
roles/netbootxyz/templates/disks/ipxe-bootloader.j2

@@ -19,8 +19,8 @@ prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe me
 :dhcp
 echo
 dhcp || goto netconfig
-isset ${next-server} && iseq ${filename} netboot.xyz.kpxe && goto tftpmenu
-isset ${next-server} && iseq ${filename} netboot.xyz.efi && goto tftpmenu
+isset ${next-server} && iseq ${filename} {{ site_name }}.kpxe && goto tftpmenu ||
+isset ${next-server} && iseq ${filename} {{ site_name }}.efi && goto tftpmenu ||
 goto menu
 
 :failsafe
@@ -52,11 +52,15 @@ goto menu || goto failsafe
 chain --autofree tftp://${next-server}/menu.ipxe || echo ${TFTP_ERR} && goto menu
 
 :menu
+{% if bootloader_https_enabled | bool %}
 set conn_type https
 chain --autofree https://${boot_domain}/menu.ipxe || echo ${HTTPS_ERR}
 sleep 5
+{% endif %}
+{% if bootloader_http_enabled | bool %}
 set conn_type http
 chain --autofree http://${boot_domain}/menu.ipxe || echo ${HTTP_ERR}
+{% endif %}
 goto localboot
 
 :localboot

+ 5 - 5
roles/netbootxyz/templates/menu/boot.ipxe.j2 → roles/netbootxyz/templates/menu/boot.cfg.j2

@@ -8,22 +8,22 @@ set site_name {{ site_name }}
 set boot_domain {{ boot_domain }}
 
 # set location of memdisk
-set memdisk http://${boot_domain}/memdisk
+set memdisk {{ memdisk_location }}
 
 # signature check enabled?
-set sigs_enabled true
+set sigs_enabled {{ sigs_enabled | default(false) | bool }}
 
 # image signatures check enabled?
-set img_sigs_enabled true
+set img_sigs_enabled {{ img_sigs_enabled | default(false) | bool }}
 
 # set location of signatures for sources
-set sigs http://${boot_domain}/sigs/
+set sigs {{ sigs_location }}
 
 # set location of latest iPXE
 set ipxe_disk netboot.xyz-undionly.kpxe
 
 # set location of custom netboot.xyz live assets
-set live_endpoint https://github.com/netbootxyz
+set live_endpoint {{ live_endpoint }}
 
 ##############################
 # netboot-xyz hosted endpoints

+ 2 - 2
roles/netbootxyz/templates/menu/bsd.ipxe.j2

@@ -9,7 +9,7 @@ iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
 
 # BSD based systems
 item --gap BSD Based Operating Systems
-{% for key, value in releases.items() | sort %}
+{% for key, value in releases.items() | sort(attribute='1.name') %}
 {% if value.enabled is defined and value.menu == "bsd" and value.enabled | bool %}
 item {{ key }} ${space} {{ value.name }}
 {% endif %}
@@ -38,4 +38,4 @@ exit 0
 
 :changebits
 iseq ${arch} x86_64 && set arch i386 || set arch x86_64
-goto bsd_menu
+goto bsd_menu

+ 32 - 0
roles/netbootxyz/templates/menu/gentoo.ipxe.j2

@@ -0,0 +1,32 @@
+#!ipxe
+
+# Gentoo Operating System
+# http://www.gentoo.org
+
+# Note: in order to boot Gentoo via iPXE, the method at http://blog.dastrup.com/?p=12 has been utilized to 
+# to allow for the Gentoo minimal disk to boot.  I've regenerated the latest boot disks and have put
+# them on https://sourceforge.net/projects/netboot-xyz/files/distros/gentoo/amd64/20160204/
+
+goto ${menu}
+
+:gentoo
+set os {{ releases.gentoo.name }}
+menu ${os} ${arch_a}
+{% for item in releases.gentoo.versions %}
+item {{ item.code_name }} ${space} ${os} {{ item.name }}
+{% endfor %}
+choose gentoo_version || goto gentoo_exit
+goto ${gentoo_version}
+
+:20160204
+set gentoopath https://master.dl.sourceforge.net/project/netboot-xyz/distros/gentoo/amd64/20160204
+echo Please note the gentoo ISO has been regenerated to work with iPXE
+echo using the method here: http://blog.dastrup.com/?p=12
+kernel --name gentoo-kernel ${gentoopath}/kernel root=/dev/ram0 init=/linuxrc loop=/image.squashfs looptype=squashfs cdroot=1 real_root=/ ${console}
+initrd --name gentoo-initrd.img ${gentoopath}/initrd
+boot
+goto gentoo
+
+:gentoo_exit
+clear menu
+chain linux.ipxe

+ 0 - 7
roles/netbootxyz/templates/menu/index.html

@@ -1,7 +0,0 @@
-#!ipxe
-####       boot.netboot.xyz initial loader        ####
-#### see https://netboot.xyz for more information ####
-set conn_type https
-chain --autofree https://boot.netboot.xyz/menu.ipxe || echo HTTPS failed... attempting HTTP...
-set conn_type http
-chain --autofree http://boot.netboot.xyz/menu.ipxe || echo HTTP failed, localbooting...

+ 11 - 0
roles/netbootxyz/templates/menu/index.html.j2

@@ -0,0 +1,11 @@
+#!ipxe
+####       {{ boot_domain }} initial loader          
+#### see https://netboot.xyz for more information
+{% if bootloader_https_enabled | bool %}
+set conn_type https
+chain --autofree https://{{ boot_domain }}/menu.ipxe || echo HTTPS failed... attempting HTTP...
+{% endif %}
+{% if bootloader_http_enabled | bool %}
+set conn_type http
+chain --autofree http://{{ boot_domain }}/menu.ipxe || echo HTTP failed, localbooting...
+{% endif %}

+ 1 - 1
roles/netbootxyz/templates/menu/linux.ipxe.j2

@@ -6,7 +6,7 @@ goto ${menu} ||
 menu Linux Installers - Current Arch [ ${arch} ]
 iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
 item --gap Popular Linux Operating Systems:
-{% for key, value in releases.items() | sort %}
+{% for key, value in releases.items() | sort(attribute='1.name') %}
 {% if value.enabled is defined and value.menu == "linux" and value.enabled | bool %}
 item {{ key }} ${space} {{ value.name }}
 {% endif %}

+ 1 - 1
roles/netbootxyz/templates/menu/live.ipxe.j2

@@ -6,7 +6,7 @@ goto ${menu} ||
 menu Live Boot Distributions - Current Arch [ ${arch} ]
 iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
 item --gap Live Boot Distributions
-item liveubuntu ${space} Ubuntu Live
+item live-ubuntu ${space} Ubuntu Live
 choose menu || goto live_exit
 echo ${cls}
 goto ${menu} ||

+ 19 - 4
roles/netbootxyz/templates/menu/liveubuntu-default.ipxe.j2

@@ -6,17 +6,32 @@ goto ${menu} ||
 menu Live Ubuntu Default (Unity) - Current Arch [ ${arch} ]
 iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
 item --gap Live Ubuntu Default (Unity)
-item bionic-18.04-default ${space} Bionic Beaver 18.04
+{% for key, value in endpoints.items() | sort %}
+{% if value.os == "ubuntu" and 'squash' in key %}
+item {{ key }} ${space} {{ value.os | title }} {{ value.version }} {{ value.flavor | title}}
+{% endif %}
+{% endfor %}
 choose menu || goto live_exit
 echo ${cls}
 goto ${menu} ||
 iseq ${sigs_enabled} true && goto verify_sigs || goto change_menu
 
-:bionic-18.04-default
-kernel ${live_endpoint}${ubuntu-18.04-live-kernel}vmlinuz boot=casper netboot=http fetch=${live_endpoint}${ubuntu-18.04-default-squash}filesystem.squashfs initrd=initrd
-initrd ${live_endpoint}${ubuntu-18.04-live-kernel}initrd
+{% for key, value in endpoints.items() | sort %}
+{% if value.os == "ubuntu" and 'squash' in key %}
+{% set kernel_name = value.kernel %}
+:{{ key }}
+set fetch_url ${live_endpoint}{{ value.path }}filesystem.squashfs
+{% for key, value in endpoints.items() | sort %}
+{% if key == kernel_name %}
+kernel ${live_endpoint}{{ value.path }}vmlinuz boot=casper netboot=http fetch=${fetch_url} initrd=initrd
+initrd ${live_endpoint}{{ value.path }}initrd
 boot
 
+{% endif %}
+{% endfor %}
+{% endif %}
+{% endfor %}
+
 :change_menu
 chain ${menu}.ipxe || goto error
 goto live_menu

+ 0 - 26
roles/netbootxyz/templates/menu/liveubuntu.ipxe.j2

@@ -1,26 +0,0 @@
-#!ipxe
-
-goto ${menu} ||
-
-:live_menu
-menu Live Ubuntu Distros - Current Arch [ ${arch} ]
-iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
-item --gap Live Ubuntu Distros
-item liveubuntu-default ${space} Ubuntu Live Default (Unity)
-choose menu || goto live_exit
-echo ${cls}
-goto ${menu} ||
-iseq ${sigs_enabled} true && goto verify_sigs || goto change_menu
-
-:verify_sigs
-imgverify ${menu}.ipxe ${sigs}${menu}.ipxe.sig || goto error
-goto change_menu
-
-:change_menu
-chain ${menu}.ipxe || goto error
-goto live_menu
-
-:live_exit
-clear menu
-exit 0
-

+ 44 - 0
roles/netbootxyz/templates/menu/mageia.ipxe.j2

@@ -0,0 +1,44 @@
+#!ipxe
+
+# Mageia Operating System
+# http://www.mageia.org/
+
+# No way to set the network interface by MAC address, let the installer ask the question
+isset ${dhcp-server} && set network dhcp || set network static,ip:${ip},netmask:${netmask},gateway:${gateway},dns:${dns}
+
+goto ${menu} ||
+
+:mageia
+set os {{ releases.mageia.name }}
+menu ${os} - ${arch} - Image Sig Checks: [${img_sigs_enabled}]
+{% for item in releases.mageia.versions %}
+item {{ item.code_name }} ${space} ${os} {{ item.name }}
+{% endfor %}
+choose version || goto mageia_exit
+goto mageia_boot
+
+:mageia_boot
+set dir {{ releases.mageia.base_dir }}/distrib/${version}/x86_64 && set dir2 isolinux/x86_64 ||
+iseq ${arch} i386 && set dir ${mageia_base_dir}/distrib/${version}/i586 && set dir2 isolinux/i386 ||
+set automatic method:http,network:${network},server:${mageia_mirror},directory:/${dir}
+imgfree
+kernel {{ releases.mageia.mirror }}/${dir}/${dir2}/vmlinuz
+initrd {{ releases.mageia.mirror }}/${dir}/${dir2}/all.rdz
+imgargs vmlinuz automatic=${automatic} vga=788 splash=silent ${console} initrd=all.rdz
+echo
+echo MD5sums:
+md5sum vmlinuz all.rdz
+iseq ${img_sigs_enabled} true && goto verify_sigs || goto skip_sigs
+:verify_sigs
+echo
+echo Checking signatures...
+imgverify vmlinuz ${sigs}${dir}/${dir2}/vmlinuz.sig || goto error
+imgverify all.rdz ${sigs}${dir}/${dir2}/all.rdz.sig || goto error
+echo Signatures verified!
+echo
+:skip_sigs
+boot || goto mageia
+
+:mageia_exit
+clear menu
+exit 0

+ 1 - 1
roles/netbootxyz/templates/menu/menu.ipxe.j2

@@ -1,7 +1,7 @@
 #!ipxe
 
 :start
-chain --autofree boot.ipxe ||
+chain --autofree boot.cfg ||
 iseq ${cls} serial && goto ignore_cls ||
 set cls:hex 1b:5b:4a  # ANSI clear screen sequence - "^[[J"
 set cls ${cls:string}

+ 52 - 0
roles/netbootxyz/templates/menu/rhel.ipxe.j2

@@ -0,0 +1,52 @@
+#!ipxe
+
+# Redhat Enterprise Linux (RHEL)
+# https://www.redhat.com
+
+isset ${dhcp-server} && set ipparam ip=dhcp || set ipparam ip=${ip}::${gateway}:${netmask}:::none nameserver=${dns}
+set ipparam BOOTIF=${netX/mac} ${ipparam}
+
+set rhel_arch x86_64
+goto ${menu} ||
+
+:rhel
+set os Red Hat Enterprise Linux
+clear rhel_version
+menu ${os}
+item --gap Installers
+item rhel_install ${space} Load ${os} Installer...
+item --gap Options:
+item arch_set ${space} Architecture [ ${rhel_arch} ]
+item url_set ${space} Base URL [ ${rhel_base_url} ]
+choose rhel_version || goto rhel_exit
+goto ${rhel_version}
+
+:arch_set
+iseq ${rhel_arch} x86_64 && set rhel_arch i386 || set rhel_arch x86_64
+goto rhel
+
+:url_set
+echo Set the HTTP URL of an extracted RHEL ISO without the trailing slash:
+echo e.g. http://www.mydomain.com/rhel/7
+echo
+echo -n URL: ${} && read rhel_base_url
+echo
+echo netboot.xyz will attempt to load the following files:
+echo ${rhel_base_url}/os/${rhel_arch}/images/pxeboot/vmlinuz
+echo ${rhel_base_url}/os/${rhel_arch}/images/pxeboot/initrd.img
+echo
+prompt Press any key to return to RHEL Menu...
+goto rhel
+
+:rhel_install
+isset ${rhel_base_url} && goto boot || echo URL not set... && goto url_set
+
+:boot
+imgfree
+kernel ${rhel_base_url}/os/${rhel_arch}/images/pxeboot/vmlinuz repo=${rhel_base_url}/os/${rhel_arch} ${console} ${ipparam} initrd=initrd.img
+initrd ${rhel_base_url}/os/${rhel_arch}/images/pxeboot/initrd.img
+md5sum vmlinuz initrd.img
+boot
+
+:rhel_exit
+exit 0

+ 59 - 0
roles/netbootxyz/templates/menu/windows.ipxe.j2

@@ -0,0 +1,59 @@
+#!ipxe
+
+# Microsoft Windows
+# https://www.microsoft.com
+
+set win_arch x64
+goto ${menu} ||
+
+:windows
+set os Microsoft Windows
+clear win_version
+menu ${os} 
+item --gap Installers
+item win_install ${space} Load ${os} Installer...
+item --gap Options:
+item arch_set ${space} Architecture [ ${win_arch} ]
+item url_set ${space} Base URL [ ${win_base_url} ]
+choose win_version || goto windows_exit
+goto ${win_version}
+
+:arch_set
+iseq ${win_arch} x64 && set win_arch x86 || set win_arch x64
+goto windows
+
+:url_set
+echo Set the HTTP URL of an extracted Windows ISO without the trailing slash:
+echo e.g. http://www.mydomain.com/windows
+echo
+echo -n URL: ${} && read win_base_url
+echo
+echo netboot.xyz will attempt to load the following files:
+echo ${win_base_url}/${win_arch}/bootmgr
+echo ${win_base_url}/${win_arch}/boot/bcd
+echo ${win_base_url}/${win_arch}/boot/boot.sdi
+echo ${win_base_url}/${win_arch}/sources/boot.wim
+echo
+prompt Press any key to return to Windows Menu...
+goto windows
+
+:win_install
+isset ${win_base_url} && goto boot || echo URL not set... && goto url_set
+
+:boot
+kernel http://${boot_domain}/wimboot
+initrd ${win_base_url}/${win_arch}/bootmgr bootmgr
+initrd ${win_base_url}/${win_arch}/boot/bcd bcd
+initrd ${win_base_url}/${win_arch}/boot/boot.sdi boot.sdi
+initrd ${win_base_url}/${win_arch}/sources/boot.wim boot.wim
+md5sum wimboot
+iseq ${img_sigs_enabled} true && goto verify_sigs || goto skip_sigs
+:verify_sigs
+echo
+echo Checking wimboot signature...
+imgverify wimboot ${sigs}wimboot.sig || goto error
+:skip_sigs
+boot
+
+:windows_exit
+exit 0

+ 5 - 0
roles/netbootxyz/vars/ubuntu.yml

@@ -1,8 +1,13 @@
 ---
 netbootxyz_packages:
   - apache2
+  - binutils-dev
+  - binutils-aarch64-linux-gnu
+  - gcc-aarch64-linux-gnu
   - build-essential
   - genisoimage
   - git
+  - isolinux
   - liblzma-dev
   - syslinux
+  - syslinux-common

+ 5 - 1
user_overrides.yml

@@ -2,7 +2,7 @@
 
 # overrides defaults in netbootxyz role
 generate_menus: true
-generate_disks: false
+generate_disks: true
 
 # set desired site name
 #site_name: mysitename.com
@@ -13,6 +13,10 @@ generate_disks: false
 # set boot version
 #boot_version: 1.00
 
+#bootloader_tftp_enabled: false
+#bootloader_https_enabled: true
+#bootloader_http_enabled: true
+
 # set overrides from standard netboot.xyz defaults
 release_overrides:
   alpinelinux: