65 lines
2.2 KiB
YAML
65 lines
2.2 KiB
YAML
---
|
|
- name: Create ISO block
|
|
delegate_to: localhost
|
|
block:
|
|
- name: Create custom kickstart file
|
|
ansible.builtin.template:
|
|
src: kickstart.ks.j2
|
|
dest: "{{ tmp_iso_path['path'] }}/kickstart.ks"
|
|
mode: 0644
|
|
|
|
- name: Add kickstart file to GRUB BIOS
|
|
ansible.builtin.replace:
|
|
path: "{{ tmp_iso_path['path'] }}/isolinux/isolinux.cfg"
|
|
regexp: ^(\s*append .*)
|
|
replace: \g<1> inst.ks=hd:LABEL={{ src_iso_label }}:/kickstart.ks
|
|
|
|
- name: Add kickstart file to GRUB EFI
|
|
ansible.builtin.replace:
|
|
path: "{{ tmp_iso_path['path'] }}/EFI/BOOT/grub.cfg"
|
|
regexp: ^(\s*linuxefi .*)
|
|
replace: \g<1> inst.ks=hd:LABEL={{ src_iso_label }}:/kickstart.ks
|
|
|
|
- name: Decrease timeout BIOS
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ tmp_iso_path['path'] }}/isolinux/isolinux.cfg"
|
|
line: timeout 30
|
|
regexp: ^timeout
|
|
- name: Remove default BIOS
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ tmp_iso_path['path'] }}/isolinux/isolinux.cfg"
|
|
regexp: ^ menu default
|
|
state: absent
|
|
- name: Set default BIOS
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ tmp_iso_path['path'] }}/isolinux/isolinux.cfg"
|
|
line: ' menu default'
|
|
regexp: ^ menu default
|
|
firstmatch: true
|
|
insertafter: ^ menu label
|
|
|
|
- name: Decrease timeout EFI
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ tmp_iso_path['path'] }}/EFI/BOOT/grub.cfg"
|
|
line: set timeout=3
|
|
regexp: ^set timeout=
|
|
|
|
- name: Set default EFI
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ tmp_iso_path['path'] }}/EFI/BOOT/grub.cfg"
|
|
line: set default="0"
|
|
regexp: ^set default=
|
|
|
|
- name: Pack ISO
|
|
ansible.builtin.command:
|
|
cmd: >
|
|
xorrisofs -U -r -v -J -joliet-long -V "{{ src_iso_label }}"
|
|
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4
|
|
-boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot
|
|
-o "{{ iso_path }}" .
|
|
chdir: "{{ tmp_iso_path['path'] }}"
|
|
changed_when:
|
|
- result['rc'] is defined
|
|
- result['rc'] == 0
|
|
register: result
|