Pushing up more changes

This commit is contained in:
Antony Messerli 2019-11-25 03:21:05 +00:00
parent 58bae264d1
commit 132399730c
17 changed files with 89 additions and 90 deletions

View file

@ -12,18 +12,29 @@ 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_repo: https://github.com/ipxe/ipxe
ipxe_branch: master
ipxe_source_dir: /usr/src/ipxe
live_endpoint: "https://github.com/netbootxyz"
netbootxyz_root: /var/www/html
bootloader_filename: ipxe-bootloader
generate_menus: true
generate_disks: true
generate_checksums: true
bootloader_tftp_enabled: false
bootloader_https_enabled: true
bootloader_http_enabled: true
bootloader_build: true
bootloader_disks:
- "netboot.xyz"
#bootloader_multiple: true
#bootloader_disks:
# - "netboot.xyz"
# - "netboot.xyz-packet"
### release values ###
releases:
alpinelinux:
@ -420,4 +431,4 @@ utilities:
menu: "pcbios"
type: "memdisk"
version: "538"
util_path: "http://mirror.sysadminguide.net/ubcd/ubcd538.iso"
util_path: "http://mirror.sysadminguide.net/ubcd/ubcd538.iso"

View file

@ -1,67 +0,0 @@
#!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

View file

@ -0,0 +1,26 @@
---
- name: Register a listing of all created iPXE bootloaders
command: ls -I checksums.txt {{ netbootxyz_root }}/ipxe/
register: netboot_disks
- name: Generate date
command: date
register: current_date
- name: Gather stat listing of directory
command: sha256sum -b {{ item }}
with_items:
- "{{ netboot_disks.stdout_lines }}"
args:
chdir: "{{ netbootxyz_root }}/ipxe/"
register: netboot_disks_stat
- name: Generate ipxe disk checksums
template:
src: checksums.txt.j2
dest: "{{ netbootxyz_root }}/ipxe/checksums.txt"
- name: Generate netboot.xyz index template
template:
src: index.html.j2
dest: "{{ netbootxyz_root }}/index.html"

View file

@ -8,4 +8,4 @@
- include: generate_disks_efi.yml
when:
- generate_disks_efi | default(true) | bool
- generate_disks_efi | default(true) | bool

View file

@ -12,6 +12,10 @@
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- name: Set var to bootloader of loop
set_fact:
bootloader_filename: "{{ bootloader_file }}"
- name: Create iPXE file directories
file:
path: "{{ item }}"
@ -38,7 +42,9 @@
repo: "{{ ipxe_repo }}"
dest: "{{ ipxe_source_dir }}"
version: "{{ ipxe_branch }}"
force: true
register: ipxe_git_checkout
- name: Copy iPXE Bootloader template to iPXE source directory
template:
src: "disks/{{ bootloader_filename }}.j2"

View file

@ -44,5 +44,5 @@
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" }
- { src: "bin-x86_64-efi/ipxe.efi", dest: "{{ bootloader_filename }}.efi" }
- { src: "ipxe-efi.eiso", dest: "{{ bootloader_filename }}-efi.iso" }

View file

@ -22,7 +22,7 @@
- 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 }}"
dest: "{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}{{ item }}"
remote_src: True
with_items:
- ".dsk"
@ -34,5 +34,5 @@
- 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"
dest: "{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}-undionly.kpxe"
remote_src: True

View file

@ -4,5 +4,13 @@
- generate_menus | default(true) | bool
- include: generate_disks.yml
with_items:
- "{{ bootloader_disks }}"
loop_control:
loop_var: bootloader_file
when:
- generate_disks | default(true) | bool
- generate_disks | default(true) | bool
- include: generate_checksums.yml
when:
- generate_checksums | default(true) | bool

View file

@ -0,0 +1,6 @@
# {{ site_name }} bootloaders generated at {{ current_date.stdout }}
# iPXE Commit: {{ ipxe_repo }}/commit/{{ ipxe_git_checkout.after }}
{% for item in netboot_disks_stat.results %}
{{ item.stdout }}
{% endfor %}

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ site_name }} BootLoaders</title>
</head>
<body>
<div style="font-family: monospace, fixed; font-weight: bold;">
<span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;_&#160;&#160;&#160;_&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;_&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><br />
<span style="">&#160;_&#160;__&#160;&#160;&#160;___|&#160;|_|&#160;|__&#160;&#160;&#160;___&#160;&#160;&#160;___&#160;|&#160;|_&#160;&#160;__&#160;&#160;___&#160;&#160;&#160;_&#160;____</span><br />
<span style="">|&#160;&#39;_&#160;\&#160;/&#160;_&#160;\&#160;__|&#160;&#39;_&#160;\&#160;/&#160;_&#160;\&#160;/&#160;_&#160;\|&#160;__|&#160;\&#160;\/&#160;/&#160;|&#160;|&#160;|_&#160;&#160;/</span><br />
<span style="">|&#160;|&#160;|&#160;|&#160;&#160;__/&#160;|_|&#160;|_)&#160;|&#160;(_)&#160;|&#160;(_)&#160;|&#160;|_&#160;_&#160;&gt;&#160;&#160;&lt;|&#160;|_|&#160;|/&#160;/&#160;</span><br />
<span style="">|_|&#160;|_|\___|\__|_.__/&#160;\___/&#160;\___/&#160;\__(_)_/\_\\__,&#160;/___|</span><br />
<span style="">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;|___/&#160;&#160;&#160;&#160;&#160;</span><br />
</div>
{% for item in netboot_disks.stdout_lines %}
<a href="ipxe/{{ item }}">{{ item }}</a><br>
{% endfor %}
</body>
</html>

View file

@ -1,11 +0,0 @@
#!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 %}

View file

@ -4,7 +4,7 @@ TYPE=$1
# Set boot domain
if [[ "${TYPE}" == "dev" ]]; then
BOOT_DOMAIN="${BUCKET_DEV}.s3-website-us-east-1.amazonaws.com/${TRAVIS_COMMIT}"
BOOT_DOMAIN="s3.amazonaws.com/${BUCKET_DEV}/${TRAVIS_COMMIT}"
elif [[ "${TYPE}" == "pr" ]]; then
BOOT_DOMAIN="test.com"
elif [[ "${TYPE}" == "rc" ]]; then

View file

@ -3,7 +3,7 @@
TYPE=$1
if [ "${TYPE}" == "dev-push" ]; then
BOOT_URL="https://${BUCKET_DEV}.s3-website-us-east-1.amazonaws.com/${TRAVIS_COMMIT}/index.html"
BOOT_URL="https://s3.amazonaws.com/${BUCKET_DEV}/${TRAVIS_COMMIT}/index.html"
elif [ "${TYPE}" == "rc-push" ]; then
BOOT_URL="https://staging.boot.netboot.xyz/${TRAVIS_TAG}/index.html"
elif [ "${TYPE}" == "live-push" ]; then

View file

@ -3,6 +3,7 @@
# overrides defaults in netbootxyz role
generate_menus: true
generate_disks: true
generate_checksums: true
# set desired site name
#site_name: mysitename.com