diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-12-10 01:24:36 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-12-10 01:24:36 +0100 |
commit | 11a1fd0d833e533c07829f1a7c03ac065d027da7 (patch) | |
tree | a480b0de38c9e2b71f14476f7514f682a6d41da6 | |
parent | added openbsd installer role (diff) |
add support for openbsd installer in vm/define
-rw-r--r-- | common/usb-install.yml | 2 | ||||
-rw-r--r-- | roles/installer/debian/defaults/main.yml | 2 | ||||
-rw-r--r-- | roles/installer/debian/tasks/main.yml | 6 | ||||
-rw-r--r-- | roles/installer/openbsd/defaults/main.yml | 2 | ||||
-rw-r--r-- | roles/installer/openbsd/tasks/main.yml | 4 | ||||
-rw-r--r-- | roles/preseed/tasks/main.yml | 2 | ||||
-rw-r--r-- | roles/vm/define/templates/libvirt-domain.xml.j2 | 18 |
7 files changed, 23 insertions, 13 deletions
diff --git a/common/usb-install.yml b/common/usb-install.yml index 43dbe257..b505ab01 100644 --- a/common/usb-install.yml +++ b/common/usb-install.yml @@ -13,7 +13,7 @@ pre_tasks: - set_fact: artifacts_dir: "{{ global_artifacts_dir }}/{{ hostname }}" - debian_installer_path: "{{ global_cache_dir }}/debian-installer" + installer_path: "{{ global_cache_dir }}/debian-installer" - file: state: directory diff --git a/roles/installer/debian/defaults/main.yml b/roles/installer/debian/defaults/main.yml index b778e85b..8962e9ad 100644 --- a/roles/installer/debian/defaults/main.yml +++ b/roles/installer/debian/defaults/main.yml @@ -20,5 +20,3 @@ debian_installer_force_download: no debian_installer_url: debian: "https://debian.ffgraz.net/debian" ubuntu: "https://debian.ffgraz.net/ubuntu" - -debian_installer_path: "{{ installer_path }}" diff --git a/roles/installer/debian/tasks/main.yml b/roles/installer/debian/tasks/main.yml index 77228e91..92fac536 100644 --- a/roles/installer/debian/tasks/main.yml +++ b/roles/installer/debian/tasks/main.yml @@ -3,7 +3,7 @@ loop_control: label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" file: - name: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}" + name: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}" state: directory - name: download installer kernel images @@ -12,7 +12,7 @@ label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" get_url: url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/linux" - dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux" + dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux" mode: 0644 force: "{{ debian_installer_force_download }}" @@ -22,6 +22,6 @@ label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" get_url: url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/initrd.gz" - dest: "{{ debian_installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz" + dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz" mode: 0644 force: "{{ debian_installer_force_download }}" diff --git a/roles/installer/openbsd/defaults/main.yml b/roles/installer/openbsd/defaults/main.yml index 4538646f..004b8ecc 100644 --- a/roles/installer/openbsd/defaults/main.yml +++ b/roles/installer/openbsd/defaults/main.yml @@ -6,5 +6,3 @@ openbsd_versions: openbsd_installer_force_download: no openbsd_installer_url: "https://cdn.openbsd.org/pub/OpenBSD/" - -openbsd_installer_path: "{{ installer_path }}" diff --git a/roles/installer/openbsd/tasks/main.yml b/roles/installer/openbsd/tasks/main.yml index 6aeba7ef..e7196258 100644 --- a/roles/installer/openbsd/tasks/main.yml +++ b/roles/installer/openbsd/tasks/main.yml @@ -3,7 +3,7 @@ loop_control: label: "openbsd-{{ item.0.version }} {{ item.1 }}" file: - name: "{{ openbsd_installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" + name: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" state: directory - name: download installer isos @@ -12,6 +12,6 @@ label: "openbsd-{{ item.0.version }} {{ item.1 }}" get_url: url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/install{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ openbsd_installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/install.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/install.iso" mode: 0644 force: "{{ openbsd_installer_force_download }}" diff --git a/roles/preseed/tasks/main.yml b/roles/preseed/tasks/main.yml index 33248b94..b1b5d275 100644 --- a/roles/preseed/tasks/main.yml +++ b/roles/preseed/tasks/main.yml @@ -2,7 +2,7 @@ - name: Copy initramfs into position copy: remote_src: yes - src: "{{ debian_installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz" + src: "{{ installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz" dest: "{{ preseed_tmpdir }}/initrd.preseed.gz" - name: Generate preseed file diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index 426d4323..c7e3a2f2 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -6,11 +6,17 @@ <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> {% if vm_define_installer %} - <kernel>{{ debian_installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux</kernel> +{% if install_distro == 'debian' or install_distro == 'ubuntu' %} + <kernel>{{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux</kernel> <initrd>{{ preseed_tmpdir }}/initrd.preseed.gz</initrd> <cmdline>console=ttyS0,115200n8</cmdline> -{% endif %} <boot dev='hd'/> +{% elif install_distro == 'openbsd' %} + <boot dev='cdrom'/> +{% endif %} +{% else %} + <boot dev='hd'/> +{% endif %} </os> <features> <acpi/> @@ -35,6 +41,14 @@ <backend model='random'>/dev/random</backend> </rng> +{% if vm_define_installer and install_distro == 'openbsd' %} + <disk type='block' device='cdrom'> + <driver name='qemu' type='raw'/> + <source file='{{ installer_path }}/openbsd-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/install.iso'/> + <target dev='hdc' bus='ide'/> + </disk> +{% endif %} + {% if 'virtio' in hostvars[hostname].install_cooked.disks %} {% for device, src in hostvars[hostname].install_cooked.disks.virtio.items() %} <disk type='block' device='disk'> |