summaryrefslogtreecommitdiff
path: root/common/usb-install.yml
blob: 27633c157754ccd61a7b095e94854bd91ed744ed (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
64
65
66
67
68
69
70
---
- name: fetch debian installer and bake initrd
  hosts: "{{ install_hostname }}"
  connection: local
  gather_facts: no

  vars_prompt:
  - name: usb_install_path
    prompt: Where is the USB installation medium mounted to?
    private: no

  roles:
  - role: installer/debian/usb
    installer_path: "{{ global_cache_dir }}/debian-installer"

  post_tasks:
  - name: Make the USB disk bootable
    pause:
      seconds: 0
      prompt: |
        You should make sure the USB disk is bootable and
        has syslinux installed.

        $ sudo apt install mbr syslinux
        $ sudo install-mbr /dev/CHANGEME
        $ sudo syslinux -i /dev/CHANGEME1
        $ sudo fdisk       /dev/CHANGEME
        [Here, make sure partition 1 is marked bootable.]

        for UEFI these steps need to be done

        $ sudo apt install syslinux-efi
        $ cp /usr/lib/syslinux/modules/efi64/* {{ usb_install_path }}/EFI/boot/
        $ cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi {{ usb_install_path }}/EFI/boot/bootx64.efi

        This will NOT be done automatically.

- name: wait for new machine to start up
  hosts: "{{ install_hostname }}"
  gather_facts: no
  tasks:
  - pause:
      prompt: |
        Please plug the stick into the machine and boot from it.
        When the installation is done press enter to continue or Ctrl-C + 'A' to abort.

    ## TODO: find a better way to fetch host key of new VMs
  - name: disable ssh StrictHostKeyChecking for the next step
    set_fact:
      ansible_ssh_extra_args: -o StrictHostKeyChecking=no

  - name: clear all gathered facts
    meta: clear_facts

  - name: wait for vm to start up
    wait_for_connection:
      delay: 5
      timeout: 120

  - name: reenable StrictHostKeyChecking
    set_fact:
      ansible_ssh_extra_args: ""

- name: run host playbook
  vars:
    params:
      files:
      - "../{{ install_environment }}/{{ install_hostname }}.yml"
      - "../{{ install_environment }}/{{ install_playbook | default('common') }}.yml"
  import_playbook: "{{ q('first_found', params) | first }}"