From 7ff35ec95420023d323e394162cd124029ea7161 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 20 Jul 2020 22:34:01 +0200 Subject: make debian installer fetch more generic --- roles/installer/debian/usb/tasks/main.yml | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'roles/installer/debian/usb') diff --git a/roles/installer/debian/usb/tasks/main.yml b/roles/installer/debian/usb/tasks/main.yml index 6220b02b..40846f13 100644 --- a/roles/installer/debian/usb/tasks/main.yml +++ b/roles/installer/debian/usb/tasks/main.yml @@ -11,18 +11,18 @@ that: usb_install_mountpoint.stat.exists msg: the path to the usb drive does not exist -- block: - - name: download installer - vars: - debian_installer_distro: "{{ install_distro }}" - debian_installer_codename: "{{ install_codename }}" - debian_installer_arch: "{{ install.arch | default('amd64') }}" - debian_installer_variant: netboot - run_once: true - import_role: - role: installer/debian/fetch +- name: download installer + vars: + debian_installer_distro: "{{ install_distro }}" + debian_installer_codename: "{{ install_codename }}" + debian_installer_arch: "{{ install.arch | default('amd64') }}" + debian_installer_variant: netboot + run_once: true + import_role: + role: installer/debian/fetch - - name: Create temporary workdir +- block: + - name: create temporary workdir tempfile: prefix: "usb-install.{{ install_hostname }}." state: directory @@ -30,30 +30,30 @@ - name: generate pressed file vars: - preseed_orig_initrd: "{{ installer_base_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}-netboot/initrd.gz" + preseed_orig_initrd: "{{ debian_installer_target_dir }}/initrd.gz" preseed_tmpdir: "{{ tmpdir.path }}" import_role: name: installer/debian/preseed - - name: Copy the preseed initramfs to the usb drive + - name: copy the preseed initramfs to the usb drive copy: src: "{{ tmpdir.path }}/initrd.{{ install_hostname }}.gz" dest: "{{ usb_install_path }}/initrd.{{ install_hostname }}.gz" always: - - name: Cleanup temporary workdir + - name: cleanup temporary workdir when: tmpdir.path is defined file: path: "{{ tmpdir.path }}" state: absent -- name: Copy linux kernel image to the USB drive +- name: copy linux kernel image to the USB drive run_once: true copy: - src: "{{ global_cache_dir }}/debian-installer/{{ install_distro }}-{{ install_codename }}/{{ install.arch | default('amd64') }}-{{ debian_installer_variant }}/linux" + src: "{{ debian_installer_target_dir }}/linux" dest: "{{ usb_install_path }}/" -- name: Generate syslinux configuration for BIOS boot +- name: generate syslinux configuration for BIOS boot run_once: true vars: syslinux_base_path: "" @@ -67,7 +67,7 @@ path: "{{ usb_install_path }}/EFI/boot" state: directory -- name: Generate syslinux configuration for UEFI boot +- name: generate syslinux configuration for UEFI boot run_once: true vars: syslinux_base_path: "../../" @@ -75,7 +75,7 @@ src: syslinux.cfg.j2 dest: "{{ usb_install_path }}/EFI/boot/syslinux.cfg" -- name: Make the USB disk bootable +- name: make the USB disk bootable pause: seconds: 0 prompt: | -- cgit v1.2.3 From a367366bfe3397b52b1fa286be8877cd23d2b657 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 20 Jul 2020 22:51:24 +0200 Subject: simpler pressed initrd handling --- roles/installer/debian/preseed/defaults/main.yml | 2 +- roles/installer/debian/preseed/tasks/main.yml | 8 +------- roles/installer/debian/usb/tasks/main.yml | 14 +++++++------- roles/vm/guest/define/templates/libvirt-domain.xml.j2 | 2 +- roles/vm/guest/install/tasks/installer-debian.yml | 17 ++++++++++------- 5 files changed, 20 insertions(+), 23 deletions(-) (limited to 'roles/installer/debian/usb') diff --git a/roles/installer/debian/preseed/defaults/main.yml b/roles/installer/debian/preseed/defaults/main.yml index b5aad35c..078b5448 100644 --- a/roles/installer/debian/preseed/defaults/main.yml +++ b/roles/installer/debian/preseed/defaults/main.yml @@ -1,5 +1,5 @@ --- -# preseed_orig_initrd +# preseed_initrd # preseed_tmpdir: # preseed_force_net_ifnames_policy: path diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index 49d08c8b..3c45001f 100644 --- a/roles/installer/debian/preseed/tasks/main.yml +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -1,10 +1,4 @@ --- -- name: Copy initramfs into position - copy: - remote_src: yes - src: "{{ preseed_orig_initrd }}" - dest: "{{ preseed_tmpdir }}/initrd.{{ install_hostname }}.gz" - - name: Generate preseed file template: src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" @@ -42,7 +36,7 @@ NamePolicy={{ preseed_force_net_ifnames_policy }} - name: Inject files into initramfs - shell: cpio -H newc -o | gzip -9 >> 'initrd.{{ install_hostname }}.gz' + shell: cpio -H newc -o | gzip -9 >> '{{ preseed_initrd }}' args: chdir: "{{ preseed_tmpdir }}" stdin: | diff --git a/roles/installer/debian/usb/tasks/main.yml b/roles/installer/debian/usb/tasks/main.yml index 40846f13..7e603ed6 100644 --- a/roles/installer/debian/usb/tasks/main.yml +++ b/roles/installer/debian/usb/tasks/main.yml @@ -28,18 +28,18 @@ state: directory register: tmpdir - - name: generate pressed file + - name: copy the original initramfs to the usb drive + copy: + src: "{{ debian_installer_target_dir }}/initrd.gz" + dest: "{{ usb_install_path }}/initrd.{{ install_hostname }}.gz" + + - name: generate host specific initial ramdisk vars: - preseed_orig_initrd: "{{ debian_installer_target_dir }}/initrd.gz" + preseed_initrd: "{{ usb_install_path }}/initrd.{{ install_hostname }}.gz" preseed_tmpdir: "{{ tmpdir.path }}" import_role: name: installer/debian/preseed - - name: copy the preseed initramfs to the usb drive - copy: - src: "{{ tmpdir.path }}/initrd.{{ install_hostname }}.gz" - dest: "{{ usb_install_path }}/initrd.{{ install_hostname }}.gz" - always: - name: cleanup temporary workdir when: tmpdir.path is defined diff --git a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 b/roles/vm/guest/define/templates/libvirt-domain.xml.j2 index f2b0cfe8..bbca0fea 100644 --- a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/guest/define/templates/libvirt-domain.xml.j2 @@ -8,7 +8,7 @@ {% if vm_define_installer %} {% if install_distro == 'debian' or install_distro == 'ubuntu' %} {{ installer_tmpdir }}/linux - {{ installer_tmpdir }}/initrd.{{ install_hostname }}.gz + {{ installer_tmpdir }}/initrd.gz console=ttyS0,115200n8 DEBCONF_DEBUG=5 {% elif install_distro == 'openbsd' %} diff --git a/roles/vm/guest/install/tasks/installer-debian.yml b/roles/vm/guest/install/tasks/installer-debian.yml index c89a1cdf..b0bc6e9e 100644 --- a/roles/vm/guest/install/tasks/installer-debian.yml +++ b/roles/vm/guest/install/tasks/installer-debian.yml @@ -8,9 +8,18 @@ import_role: name: installer/debian/fetch +- name: copy the installer files to the temporary installer directory + loop: + - linux + - initrd.gz + copy: + remote_src: yes + src: "{{ debian_installer_target_dir }}/{{ item }}" + dest: "{{ tmpdir.path }}/{{ item }}" + - name: generate host specific initial ramdisk vars: - preseed_orig_initrd: "{{ debian_installer_target_dir }}/initrd.gz" + preseed_initrd: "{{ tmpdir.path }}/initrd.gz" preseed_tmpdir: "{{ tmpdir.path }}" preseed_virtual_machine: yes preseed_force_net_ifnames_policy: path @@ -18,9 +27,3 @@ install_interface: enp1s1 import_role: name: installer/debian/preseed - -- name: copy installer kernel image to temporary installer directory - copy: - remote_src: yes - src: "{{ debian_installer_target_dir }}/linux" - dest: "{{ tmpdir.path }}/linux -- cgit v1.2.3