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

99 lines
2.2 KiB
YAML
Raw Normal View History

2020-08-26 10:10:36 +00:00
- name: install ipxe
package:
name: ipxe
state: present
tags:
- pxe
- bios
- efi
- ipxe
- name: copy ipxe
copy:
src: "{{ item }}"
dest: /srv/tftp/
remote_src: yes
with_items:
- /usr/lib/ipxe/ipxe.efi
- /usr/lib/ipxe/ipxe.pxe
tags:
- pxe
- ipxe
- bios
- efi
- name: write ipxe menu
copy:
content: |
#!ipxe
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 p pxelinux PXE Linux
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 fai/vmlinuz-4.19.0-10-amd64
initrd fai/initrd.img-4.19.0-10-amd64
imgargs vmlinuz-4.19.0-10-amd64 ip=dhcp root=live:http://192.168.33.1/tftp/fai/squash.img FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC=http://192.168.33.1/fai/config.tar FAI_ACTION=install
boot || goto failed
goto start
:dban
kernel dban.bzi
imgargs dban.bzi silent vga=785
boot || goto failed
goto start
dest: /srv/tftp/menu.ipxe
mode: 0644
owner: root
group: root
tags:
- pxe
- tftp
- fai