Latest tuning, including utility menu generation

Creates proper ansible role structure
Creates utilities listing and allows for utility menu overrides
Splits utilities into efi and pcbios (legacy) so options
are hidden if they can't be used.
Add package list for debian
Split Ubuntu Live version loaders into seperate methods as versions
can behave differently.
This commit is contained in:
Antony Messerli 2019-11-17 19:49:25 +00:00
parent 0cefff109a
commit 214e34961f
16 changed files with 344 additions and 23 deletions

View File

@ -20,7 +20,7 @@ COPY . /ansible
RUN \
echo "**** running ansible ****" && \
cd /ansible && \
ansible-playbook -i inventory/all netbootxyz.yml
ansible-playbook -i inventory/all site.yml
# runtime stage
FROM alpine:3.10

View File

@ -20,7 +20,7 @@ This is a seperate repo for now but will more than likely roll into the existing
To generate, run:
```
ansible-playbook -i inventory/all netbootxyz.yml
ansible-playbook -i inventory/all site.yml
```
The build output will be located in /var/www/html on Debian OSs.

View File

@ -0,0 +1,39 @@
Ansible role: netbootxyz
========================
Uses Ansible to generate a self hosted environment of netboot.xyz for use anywhere
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
Apache
Author Information
------------------
Website: https://netboot.xyz
Author: Antony Messerli

View File

@ -239,15 +239,6 @@ releases:
code_name: "7.1"
- name: "cauldron"
code_name: "cauldron"
mirbsd:
name: "MirOS"
mirror: "https://www.mirbsd.org/"
base_dir: "MirOS"
enabled: true
menu: "bsd"
versions:
- name: "Latest (i386)"
code_name: "mirbsd"
nixos:
name: "NixOS"
enabled: true
@ -370,3 +361,62 @@ releases:
code_name: "bionic"
- name: "16.04 LTS Xenial Xerus"
code_name: "xenial"
# utility values
utilities:
avg:
name: "AVG Rescue CD"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "160420a12074"
util_path: "http://download.avg.com/filedir/inst/avg_arl_cdi_all_120_160420a12074.iso"
breakin:
name: "Breakin"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "4.26.1-53"
util_path: "http://www.advancedclustering.com/wp-content/uploads/2017/02/bootimage-4.26.1-53.iso"
clonezilla:
name: "Clonezilla"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "2.6.2-15"
util_path: "http://master.dl.sourceforge.net/project/clonezilla/clonezilla_live_stable/2.6.2-15/clonezilla-live-2.6.2-15-amd64.iso"
dban:
name: "DBAN"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "2.3.0"
util_path: "http://master.dl.sourceforge.net/project/dban/dban/dban-2.3.0/dban-2.3.0_i586.iso"
gparted:
name: "GParted"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "1.0.0-3"
util_path: "http://master.dl.sourceforge.net/project/gparted/gparted-live-stable/1.0.0-3/gparted-live-1.0.0-3-amd64.iso"
memtest:
name: "Memtest"
enabled: true
menu: "pcbios"
type: "memtest"
version: "5.01.0"
util_path: "https://boot.netboot.xyz/utils/memtest86-5.01.0"
supergrub:
name: "SuperGRUB"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "2.04s1"
util_path: "http://master.dl.sourceforge.net/project/supergrub2/2.04s1/super_grub2_disk_2.04s1/super_grub2_disk_hybrid_2.04s1.iso"
ubcd:
name: "Ultimate Boot CD (UBCD)"
enabled: true
menu: "pcbios"
type: "memdisk"
version: "538"
util_path: "http://mirror.sysadminguide.net/ubcd/ubcd538.iso"

View File

@ -0,0 +1,15 @@
galaxy_info:
author: Antony Messerli
description: Installs a self hosted version of netboot.xyz
license: Apache-2.0
min_ansible_version: 2.7
platforms:
- name: Ubuntu
versions:
- all
- name: Centos
versions:
- all
galaxy_tags:
- system
dependencies: []

View File

@ -1,5 +1,5 @@
---
- name: Combine overrides with defaults
- name: Combine overrides with release defaults
set_fact:
_releases: "{{ releases|combine(release_overrides, recursive=True) }}"
@ -7,6 +7,14 @@
set_fact:
releases: "{{ _releases }}"
- name: Combine overrides with utilities defaults
set_fact:
_utilities: "{{ utilities|combine(utilities_overrides, recursive=True) }}"
- name: Set utility with user overrides
set_fact:
utilities: "{{ _utilities }}"
- name: Generate directories
file:
path: "{{ netbootxyz_root }}"

View File

@ -16,7 +16,7 @@ set os Fedora
menu Fedora - ${arch} - Image Sig Checks: [${img_sigs_enabled}]
item --gap Latest Releases
{% for item in releases.fedora.versions %}
item {{ item.name }} ${space} ${os} {{ item.name }}
item {{ item.code_name }} ${space} ${os} {{ item.name }}
{% endfor %}
iseq ${arch} x86_64 && item rawhide ${space} ${os} rawhide ||
isset ${osversion} || choose osversion || goto linux_menu

View File

@ -43,15 +43,21 @@ set squash_url ${live_endpoint}{{ value.path }}filesystem.squashfs
{% for key, value in endpoints.items() | sort %}
{% if key == kernel_name %}
set kernel_url ${live_endpoint}{{ value.path }}
goto boot
{% endif %}
{% endfor %}
goto {{ value.version }}-boot
{% endif %}
{% endfor %}
:boot
:18.04-boot
imgfree
kernel ${kernel_url}vmlinuz boot=casper netboot=http fetch=${squash_url} initrd=initrd
kernel ${kernel_url}vmlinuz ip-dhcp boot=casper netboot=http fetch=${squash_url} initrd=initrd
initrd ${kernel_url}initrd
boot
:19.10-boot
imgfree
kernel ${kernel_url}vmlinuz ip=dhcp boot=casper netboot=url url=${squash_url} initrd=initrd
initrd ${kernel_url}initrd
boot

View File

@ -48,7 +48,7 @@ iseq ${menu_freedos} 1 && item freedos ${space} FreeDOS ||
iseq ${menu_security} 1 && item security ${space} Security Related ||
iseq ${menu_windows} 1 && item windows ${space} Windows ||
item --gap Tools:
iseq ${menu_utils} 1 && item utils ${space} Utilities ||
iseq ${menu_utils} 1 && item utils-${platform} ${space} Utilities ||
iseq ${arch} x86_64 && set bits 64 || set bits 32
item changebits ${space} Architecture: ${arch} (${bits}bit)
item shell ${space} iPXE shell

View File

@ -0,0 +1,90 @@
#!ipxe
menu Utilities - Image Sig Checks: [${img_sigs_enabled}]
item --gap Utilities:
{% for key, value in utilities.items() | sort(attribute='1.name') %}
{% if value.enabled | bool and value.menu == "efi" %}
item {{ key }} ${space} {{ value.name }}
{% endif %}
{% endfor %}
item --gap netboot.xyz tools:
item nbxyz-custom ${space} Set Github username [user: ${github_user}]
item testdistro ${space} Test Distribution ISO
item testpr ${space} Test forked netboot.xyz branch or hash
choose --default ${menu} menu || goto utils_exit
echo ${cls}
goto ${menu} ||
chain ${menu}.ipxe || goto utils_exit
goto utils_exit
{% for key, value in utilities.items() | sort %}
{% if value.enabled | bool and value.menu == "efi" %}
:{{ key }}
set util_path {{ value.util_path }}
set util_file {{ value.util_path | basename }}
set util_version {{ value.version }}
goto boot_{{ value.type }}
{% endif %}
{% endfor %}
:boot_memdisk
imgfree
kernel ${memdisk} iso raw
initrd --name ${util_file} ${util_path}
echo
echo MD5sums:
md5sum memdisk ${util_file}
iseq ${img_sigs_enabled} true && goto verify_sigs || goto skip_sigs
:verify_sigs
echo
echo Checking signatures...
imgverify memdisk ${sigs}memdisk.sig || goto error
imgverify ${util_file} ${sigs}${menu}/${util_file}.sig || goto error
echo Signatures verified!
echo
:skip_sigs
boot
goto utils_exit
:boot_memtest
chain https://${util_path} && goto main_menu ||
goto utils_exit
:nbxyz-custom
echo EXPERIMENTAL
echo
echo Make sure you have a fork of https://github.com/antonym/netboot.xyz-custom.
echo You can then customize your fork as needed and set up your own custom options.
echo Once your username is set, a custom option will appear on the main menu.
echo
echo -n Please enter your Github username: ${} && read github_user
goto utils_exit
:testdistro
echo This option will allow you to test booting an ISO using memdisk. Please
echo specify the URL of the ISO you want to test and it will automatically
echo attempt to load the ISO using memdisk.
echo -n URL: ${} && read distro_iso
kernel ${memdisk} iso raw
initrd ${distro_iso}
boot
goto utils_exit
:testpr
clear github_user
clear github_branch_or_hash
echo This will chainload into a testing branch of netboot.xyz. You'll need to enter
echo your Github username and the first part of the commit hash of the commit you want
echo to test or the branch name. This assumes you are testing from a forked netboot.xyz
echo repo.
echo
echo -n Specify Github username: ${} && read github_user
echo -n Specify Github branch name or commit hash ( i.e. my_feature or 30b7ca ): ${} && read github_branch_or_hash
echo
echo Attempting to chainload branch or hash:
chain --autofree https://raw.githubusercontent.com/${github_user}/netboot.xyz/${github_branch_or_hash}/src/menu.ipxe || echo Unable to find Github branch or hash... && sleep 5 && goto utils_exit
goto utils_exit
:utils_exit
clear menu
exit 0

View File

@ -0,0 +1,90 @@
#!ipxe
menu Utilities - Image Sig Checks: [${img_sigs_enabled}]
item --gap Utilities:
{% for key, value in utilities.items() | sort(attribute='1.name') %}
{% if value.enabled | bool and value.menu == "pcbios" %}
item {{ key }} ${space} {{ value.name }}
{% endif %}
{% endfor %}
item --gap netboot.xyz tools:
item nbxyz-custom ${space} Set Github username [user: ${github_user}]
item testdistro ${space} Test Distribution ISO
item testpr ${space} Test forked netboot.xyz branch or hash
choose --default ${menu} menu || goto utils_exit
echo ${cls}
goto ${menu} ||
chain ${menu}.ipxe || goto utils_exit
goto utils_exit
{% for key, value in utilities.items() | sort %}
{% if value.enabled | bool and value.menu == "pcbios" %}
:{{ key }}
set util_path {{ value.util_path }}
set util_file {{ value.util_path | basename }}
set util_version {{ value.version }}
goto boot_{{ value.type }}
{% endif %}
{% endfor %}
:boot_memdisk
imgfree
kernel ${memdisk} iso raw
initrd --name ${util_file} ${util_path}
echo
echo MD5sums:
md5sum memdisk ${util_file}
iseq ${img_sigs_enabled} true && goto verify_sigs || goto skip_sigs
:verify_sigs
echo
echo Checking signatures...
imgverify memdisk ${sigs}memdisk.sig || goto error
imgverify ${util_file} ${sigs}${menu}/${util_file}.sig || goto error
echo Signatures verified!
echo
:skip_sigs
boot
goto utils_exit
:boot_memtest
chain https://${util_path} && goto main_menu ||
goto utils_exit
:nbxyz-custom
echo EXPERIMENTAL
echo
echo Make sure you have a fork of https://github.com/antonym/netboot.xyz-custom.
echo You can then customize your fork as needed and set up your own custom options.
echo Once your username is set, a custom option will appear on the main menu.
echo
echo -n Please enter your Github username: ${} && read github_user
goto utils_exit
:testdistro
echo This option will allow you to test booting an ISO using memdisk. Please
echo specify the URL of the ISO you want to test and it will automatically
echo attempt to load the ISO using memdisk.
echo -n URL: ${} && read distro_iso
kernel ${memdisk} iso raw
initrd ${distro_iso}
boot
goto utils_exit
:testpr
clear github_user
clear github_branch_or_hash
echo This will chainload into a testing branch of netboot.xyz. You'll need to enter
echo your Github username and the first part of the commit hash of the commit you want
echo to test or the branch name. This assumes you are testing from a forked netboot.xyz
echo repo.
echo
echo -n Specify Github username: ${} && read github_user
echo -n Specify Github branch name or commit hash ( i.e. my_feature or 30b7ca ): ${} && read github_branch_or_hash
echo
echo Attempting to chainload branch or hash:
chain --autofree https://raw.githubusercontent.com/${github_user}/netboot.xyz/${github_branch_or_hash}/src/menu.ipxe || echo Unable to find Github branch or hash... && sleep 5 && goto utils_exit
goto utils_exit
:utils_exit
clear menu
exit 0

View File

@ -0,0 +1 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- netbootxyz

View File

@ -0,0 +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

View File

@ -17,9 +17,13 @@ generate_disks: true
#bootloader_https_enabled: true
#bootloader_http_enabled: true
# set overrides from standard netboot.xyz defaults
release_overrides:
alpinelinux:
name: "ALPINELINUX"
fedora:
mirror: "iad.mirror.rackspace.com"
# set release overrides from standard netboot.xyz defaults
#release_overrides:
# alpinelinux:
# name: "ALPINELINUX"
# fedora:
# mirror: "mirrors.kernel.org"
# set utilities_overrides from standard netboot.xyz defaults
#utilities_overrides: