summaryrefslogtreecommitdiff
path: root/roles/installer/debian
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-22 16:12:14 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-22 16:12:14 +0200
commit5d64415a59721b407d0e3817dee9d9b727f2dfe4 (patch)
treeb7339938197a9771e38cc0a695d96f4ba22e3e1f /roles/installer/debian
parentinstaller/usb: fix multi-install menu (diff)
add debian installer iso variant
Diffstat (limited to 'roles/installer/debian')
-rw-r--r--roles/installer/debian/iso/defaults/main.yml2
-rw-r--r--roles/installer/debian/iso/tasks/main.yml69
-rw-r--r--roles/installer/debian/iso/templates/grub.cfg.j220
-rw-r--r--roles/installer/debian/iso/templates/isolinux.cfg.j215
4 files changed, 106 insertions, 0 deletions
diff --git a/roles/installer/debian/iso/defaults/main.yml b/roles/installer/debian/iso/defaults/main.yml
new file mode 100644
index 00000000..8949e5b3
--- /dev/null
+++ b/roles/installer/debian/iso/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+iso_install_target_dir: "{{ global_artifacts_dir }}/{{ install_hostname }}/debian-installer"
diff --git a/roles/installer/debian/iso/tasks/main.yml b/roles/installer/debian/iso/tasks/main.yml
new file mode 100644
index 00000000..70cb2a7b
--- /dev/null
+++ b/roles/installer/debian/iso/tasks/main.yml
@@ -0,0 +1,69 @@
+---
+- name: download installer
+ run_once: true
+ vars:
+ debian_installer_distro: "{{ install_distro }}"
+ debian_installer_codename: "{{ install_codename }}"
+ debian_installer_arch: "{{ install.arch | default('amd64') }}"
+ debian_installer_variant: mini-iso
+ import_role:
+ role: installer/debian/fetch
+
+- block:
+ - name: create temporary workdir
+ tempfile:
+ prefix: "iso-install.{{ install_hostname }}."
+ state: directory
+ register: tmpdir
+
+ - name: extract the original initramfs from the original iso
+ command: xorriso -osirrox on -dev "{{ debian_installer_target_dir }}/mini.iso" -extract initrd.gz initrd.gz
+ args:
+ chdir: "{{ tmpdir.path }}"
+
+ - name: fix initrd permissions
+ file:
+ path: "{{ tmpdir.path }}/initrd.gz"
+ mode: 0664
+
+ - name: generate host specific initial ramdisk
+ vars:
+ preseed_initrd: "{{ tmpdir.path }}/initrd.gz"
+ preseed_tmpdir: "{{ tmpdir.path }}"
+ import_role:
+ name: installer/debian/preseed
+
+ - name: generate isolinux configuration for BIOS boot
+ run_once: true
+ template:
+ src: isolinux.cfg.j2
+ dest: "{{ tmpdir.path }}/isolinux.cfg"
+
+ - name: generate grub configuration for UEFI boot
+ run_once: true
+ template:
+ src: grub.cfg.j2
+ dest: "{{ tmpdir.path }}/grub.cfg"
+
+
+ - name: create destination directory
+ file:
+ path: "{{ iso_install_target_dir }}"
+ state: directory
+
+ - name: make sure target image does not exist
+ file:
+ path: "{{ iso_install_target_dir }}/{{ install_hostname }}.iso"
+ state: absent
+
+ - name: generate target iso image
+ command: xorriso -indev "{{ debian_installer_target_dir }}/mini.iso" -outdev "{{ iso_install_target_dir }}/{{ install_hostname }}.iso" -boot_image any replay -update initrd.gz initrd.gz -update isolinux.cfg isolinux.cfg -update grub.cfg /boot/grub/grub.cfg
+ args:
+ chdir: "{{ tmpdir.path }}"
+
+ always:
+ - name: cleanup temporary workdir
+ when: tmpdir.path is defined
+ file:
+ path: "{{ tmpdir.path }}"
+ state: absent
diff --git a/roles/installer/debian/iso/templates/grub.cfg.j2 b/roles/installer/debian/iso/templates/grub.cfg.j2
new file mode 100644
index 00000000..52b4bf10
--- /dev/null
+++ b/roles/installer/debian/iso/templates/grub.cfg.j2
@@ -0,0 +1,20 @@
+if loadfont $prefix/font.pf2 ; then
+ set gfxmode=800x600
+ set gfxpayload=keep
+ insmod efi_gop
+ insmod efi_uga
+ insmod video_bochs
+ insmod video_cirrus
+ insmod gfxterm
+ terminal_output gfxterm
+fi
+
+set menu_color_normal=white/black
+set menu_color_highlight=black/light-gray
+set timeout=10
+set default=0
+
+menuentry "automated installer for {{ install_hostname }}" {
+ linux /linux --- install {{ (hostvars[install_hostname].install_cooked.kernel_cmdline | default([])) | join(' ') }}
+ initrd /initrd.gz
+}
diff --git a/roles/installer/debian/iso/templates/isolinux.cfg.j2 b/roles/installer/debian/iso/templates/isolinux.cfg.j2
new file mode 100644
index 00000000..34d42aa2
--- /dev/null
+++ b/roles/installer/debian/iso/templates/isolinux.cfg.j2
@@ -0,0 +1,15 @@
+DEFAULT {{ install_hostname }}
+TIMEOUT 100
+PROMPT 1
+SAY *****************************************
+SAY **
+SAY ** Distro: {{ install_distro }}
+SAY ** Codename: {{ install_codename }}
+SAY **
+SAY ** will be booting automated installer for {{ install_hostname }} in 10s ...
+SAY **
+
+LABEL {{ install_hostname }}
+ KERNEL linux
+ INITRD initrd.gz
+ APPEND install {{ (hostvars[install_hostname].install_cooked.kernel_cmdline | default([])) | join(' ') }}