summaryrefslogtreecommitdiff
path: root/roles/installer/openbsd/tasks/main.yml
blob: c631728430fb9553f0d13865b31b1367409c5f3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- name: prepare directories for installer isos
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  file:
    name: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}"
    state: directory

- name: download installer isos
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  get_url:
    url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso"
    dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd.iso"
    mode: 0644
    force: "{{ openbsd_installer_force_download }}"

- name: install xorriso
  apt:
    name: xorriso
    state: present

## TODO: only do this if images have been updated
- name: extract boot.conf from original iso image
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  command: xorriso -osirrox on -dev cd.iso -extract etc/boot.conf boot.conf
  args:
    chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}"

- name: change boot.conf to switch to com0 as main tty
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  lineinfile:
    path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/boot.conf"
    regexp: '^set\s+tty\s'
    line: "set tty com0"

- name: make sure target image does not exist
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  file:
    path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-com0.iso"
    state: absent

- name: generate target iso image
  loop: "{{ openbsd_versions | subelements('arch') }}"
  loop_control:
    label: "openbsd-{{ item.0.version }} {{ item.1 }}"
  command: xorriso -indev "cd.iso" -outdev "cd-com0.iso" -boot_image any keep -pathspecs on -add /etc/boot.conf=boot.conf
  args:
    chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}"