summaryrefslogtreecommitdiff
path: root/roles/vm/install/tasks
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-07 22:09:19 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-11 02:29:02 +0200
commit6eacc2ad5539abf37dc90cd378b44320f7758869 (patch)
treeeacbf207b610a8ee93f830b381d91491671f6ae5 /roles/vm/install/tasks
parentch-oulu: interface config (diff)
refactor vm role names
Diffstat (limited to 'roles/vm/install/tasks')
-rw-r--r--roles/vm/install/tasks/installer-debian.yml21
-rw-r--r--roles/vm/install/tasks/installer-openbsd.yml19
-rw-r--r--roles/vm/install/tasks/main.yml88
3 files changed, 0 insertions, 128 deletions
diff --git a/roles/vm/install/tasks/installer-debian.yml b/roles/vm/install/tasks/installer-debian.yml
deleted file mode 100644
index e0492969..00000000
--- a/roles/vm/install/tasks/installer-debian.yml
+++ /dev/null
@@ -1,21 +0,0 @@
----
-- name: fetch debian installer files
- vars:
- debian_installer_distro: "{{ install_distro }}"
- debian_installer_codename: "{{ install_codename }}"
- debian_installer_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
- debian_installer_variant: netboot
- import_role:
- name: installer/debian/fetch
-
-- name: generate host specific initial ramdisk
- vars:
- ssh_keys_root: "{{ hostvars[install_hostname].ssh_keys_root }}"
- preseed_orig_initrd: "{{ installer_base_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}-netboot/initrd.gz"
- preseed_tmpdir: "{{ tmpdir.path }}"
- preseed_virtual_machine: yes
- preseed_force_net_ifnames_policy: path
- preseed_no_netplan: yes
- install_interface: enp1s1
- import_role:
- name: installer/debian/preseed
diff --git a/roles/vm/install/tasks/installer-openbsd.yml b/roles/vm/install/tasks/installer-openbsd.yml
deleted file mode 100644
index afa17c45..00000000
--- a/roles/vm/install/tasks/installer-openbsd.yml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: fetch openbsd installer files
- vars:
- openbsd_installer_version: "{{ install_codename }}"
- openbsd_installer_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
- import_role:
- name: installer/openbsd/fetch
-
-- name: generate host specific autoinstall iso
- vars:
- ssh_keys_root: "{{ hostvars[install_hostname].ssh_keys_root }}"
- obsd_autoinstall_orig_iso: "{{ installer_base_path }}/openbsd-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/install{{ openbsd_installer_version_short }}.iso"
- obsd_autoinstall_tmpdir: "{{ tmpdir.path }}"
- obsd_autoinstall_version: "{{ install_codename }}"
- obsd_autoinstall_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
- obsd_autoinstall_serial_device: com0
- install_interface: vio0
- import_role:
- name: installer/openbsd/autoinstall
diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml
deleted file mode 100644
index a4511459..00000000
--- a/roles/vm/install/tasks/main.yml
+++ /dev/null
@@ -1,88 +0,0 @@
----
-- name: create lvm-based disks for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'lvm') | list }}"
- loop_control:
- label: "{{ item.value.vg }} / {{ item.value.lv }} ({{ item.value.size }})"
- lvol:
- vg: "{{ item.value.vg }}"
- lv: "{{ item.value.lv }}"
- size: "{{ item.value.size }}"
- state: present
-
-- name: create zfs base datasets for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | map(attribute='value.backend') | map('default', 'default') | unique | list }}"
- zfs:
- name: "{{ vm_host_cooked.zfs[item].pool }}/{{ vm_host_cooked.zfs[item].name }}/{{ install_hostname }}"
- state: present
- extra_zfs_properties:
- canmount: no
- mountpoint: none
-
-- name: create zfs-based disk volumes for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | list }}"
- loop_control:
- label: "{{ item.value.name }} on backend {{ item.value.backend | default('default') }} ({{ item.value.size }})"
- zfs:
- name: "{{ vm_host_cooked.zfs[item.value.backend | default('default')].pool }}/{{ vm_host_cooked.zfs[item.value.backend | default('default')].name }}/{{ install_hostname }}/{{ item.value.name }}"
- state: present
- extra_zfs_properties: "{{ item.value.properties | default({}) | combine({'volsize': item.value.size}) }}"
-
-
-- block:
- - name: create a temporary workdir
- tempfile:
- path: "{{ installer_base_path }}/"
- prefix: ".{{ install_hostname }}."
- state: directory
- register: tmpdir
-
- - when: install_distro in ['debian', 'ubuntu']
- import_tasks: installer-debian.yml
-
- - when: install_distro in ['openbsd']
- import_tasks: installer-openbsd.yml
-
- - name: Make installer workdir readable by qemu
- acl:
- path: "{{ tmpdir.path }}"
- state: present
- entity: libvirt-qemu
- etype: user
- permissions: rx
-
- - vars:
- vm_define_installer: yes
- installer_tmpdir: "{{ tmpdir.path }}"
- import_role:
- name: vm/define
-
- - debug:
- msg: "you can check on the status of the installer running this command 'virsh console {{ install_hostname }}' on host {{ inventory_hostname }}."
-
- - when: installer_manual_steps_msg is defined
- pause:
- prompt: |
- Mind that this installer needs manual steps to be performed:
-
- {{ installer_manual_steps_msg | indent(2) }}
-
- When done press enter to continue or Ctrl-C + 'A' to abort.
-
- - name: wait for installer to finish or crash
- wait_for_virt:
- name: "{{ install_hostname }}"
- states: shutdown,crashed
- timeout: 1800
- register: installer_result
- failed_when: installer_result.failed or installer_result.state == "crashed"
-
- always:
- - name: cleanup temporary workdir
- file:
- path: "{{ tmpdir.path }}"
- state: absent
-
-- vars:
- vm_define_installer: no
- import_role:
- name: vm/define