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

83 lines
2.0 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 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 {{ fai_live_vmlinuz }}
initrd {{ fai_live_initrd }}
imgargs {{ fai_live_vmlinuz }} ip=dhcp root=live:http://{{ server_name }}/tftp/fai/squash.img FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC=http://{{ server_name }}/fai/config.tar FAI_ACTION=install net.ifnames=0
boot || goto failed
goto start
:dban
kernel dban.bzi
imgargs dban.bzi silent vga=785
boot || goto failed
goto start
dest: /srv/tftp/fai/menu.ipxe
mode: 0644
owner: root
group: root