summaryrefslogtreecommitdiff
path: root/roles/installer/openbsd/autoinstall/tasks/main.yml
blob: cb9975de98162f082950c1f9891a5a157a8ff0a0 (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
57
58
59
60
61
62
63
---
- name: create temporary directories
  loop:
    - files/etc
    - files/sets
    - site/
  file:
    path: "{{ obsd_autoinstall_tmpdir }}/{{ item }}"
    state: directory

- name: extract installer files from iso
  iso_extract:
    image: "{{ installer_path }}/openbsd-{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/install.iso"
    dest: "{{ obsd_autoinstall_tmpdir }}/files"
    files:
      - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/cdbr"
      - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/cdboot"
      - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/bsd.rd"

- name: generate bootloader and installer configuration
  loop:
    - auto_install.conf
    - boot.conf
  template:
    src: "{{ item }}.j2"
    dest: "{{ obsd_autoinstall_tmpdir }}/files/etc/{{ item }}"

- name: generate random seed
  shell: "head -c512 < /dev/random > {{ obsd_autoinstall_tmpdir }}/files/etc/random.seed"

- name: extract file-sets from iso
  vars:
    set_names:
      - bsd
      - bsd.rd
      - "INSTALL.{{ obsd_autoinstall_arch }}"
      - "{{ obsd_autoinstall_file_sets | product([obsd_autoinstall_version_short+'.tgz']) | map('join') | list }}"
  iso_extract:
    image: "{{ installer_path }}/openbsd-{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/install.iso"
    dest: "{{ obsd_autoinstall_tmpdir }}/files/sets"
    files: "{{ [obsd_autoinstall_version+'/'+obsd_autoinstall_arch+'/'] | product(set_names | flatten) | map('join') | list }}"

- name: generate install.site script
  template:
    src: install.site.j2
    dest: "{{ obsd_autoinstall_tmpdir }}/site/install.site"
    mode: 0755

- name: generate site tarball
  archive:
    path: "{{ obsd_autoinstall_tmpdir }}/site/"
    dest: "{{ obsd_autoinstall_tmpdir }}/files/sets/site{{ obsd_autoinstall_version_short }}.tgz"

- name: generate host specific installer image
  command: 'genisoimage -RTLldDN -o "install.iso" -no-emul-boot -b "cdbr" -c "boot.catalog" files/'
  args:
    chdir: "{{ obsd_autoinstall_tmpdir }}/"

- name: set additional installer info
  set_fact:
    installer_manual_steps_msg: |
      * at the installer prompt select: (S)hell
      * # mount_cd9660 /dev/cd0c /mnt && cp /mnt/etc/auto_install.conf / && autoinstall