ansible-install-server/roles/fai/tasks/fai-ipxe.yml

82 lines
2.1 KiB
YAML

- package:
name: ipxe
state: present
- name: copy ipxe
copy:
src: "{{ item }}"
dest: /srv/tftp/fai
remote_src: yes
with_items:
- /usr/lib/ipxe/ipxe.efi
- /usr/lib/ipxe/ipxe.pxe
- name: write ipxe menu
copy:
content: |
#!ipxe
set boot-root {{ http_mirror_ipxe_root_url }}
set menu-default fai
set menu-timeout 5000
set submenu-timeout ${menu-timeout}
isset ${menu-default} || set menu-default exit
# Figure out if client is 64-bit capable
cpuid --ext 29 && set arch x64 || set arch x86
cpuid --ext 29 && set archl amd64 || set archl i386
:start
menu iPXE boot menu
item --key f fai FAI Installer
item --gap --
item --key d dban Dariks boot and nuke (DBAN)
item --gap --
item --key c config Configure settings
item shell Drop to iPXE shell
item reboot Reboot computer
item
item --key x exit Exit iPXE and continue BIOS boot
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}
:cancel
echo You cancelled the menu, dropping you to a shell
:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start
:failed
echo Booting failed, dropping to shell
goto shell
:config
config
goto start
:reboot
reboot
:exit
exit
:fai
kernel --name fai ${boot-root}/{{ fai_live_vmlinuz }} root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0 ip=dhcp
imgfetch --name fai ${boot-root}/{{ fai_live_initrd }}
boot || goto failed
goto start
:dban
kernel ${boot-root}/dban.bzi silent vga=785
boot || goto failed
goto start
dest: /srv/tftp/fai/menu.ipxe
mode: 0644
owner: root
group: root