summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-05 23:28:12 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-05 23:28:12 +0200
commit7b1e504b8b17b0e1e3caf1de3f1a3ac5cc0f3f17 (patch)
tree459313226df57aa5caa644930b53c59bf9e6c788 /common
parentadd TODO for debian installer download verification (diff)
renovate usb-install
Diffstat (limited to 'common')
-rw-r--r--common/usb-install.yml112
1 files changed, 47 insertions, 65 deletions
diff --git a/common/usb-install.yml b/common/usb-install.yml
index 56508af8..27633c15 100644
--- a/common/usb-install.yml
+++ b/common/usb-install.yml
@@ -5,84 +5,66 @@
gather_facts: no
vars_prompt:
- - name: usbdrive_path
+ - name: usb_install_path
prompt: Where is the USB installation medium mounted to?
- default: ""
private: no
- pre_tasks:
- - set_fact:
- artifacts_dir: "{{ global_artifacts_dir }}/{{ install_hostname }}"
- installer_path: "{{ global_cache_dir }}/debian-installer"
-
- - file:
- state: directory
- name: "{{ artifacts_dir }}"
-
roles:
- role: installer/debian/usb
+ installer_path: "{{ global_cache_dir }}/debian-installer"
post_tasks:
- - stat:
- path: "{{ usbdrive_path }}"
- register: pathcheck
+ - 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.]
- - when: pathcheck.stat.exists
- block:
- - name: Copy generated files to the USB drive
- loop:
- - "{{ artifacts_dir }}/initrd.preseed.gz"
- - "{{ global_cache_dir }}/debian-installer/{{ install_distro }}-{{ install_codename }}/{{ install.arch | default('amd64') }}/linux"
- loop_control:
- label: "{{ item | basename }}"
- copy:
- src: "{{ item }}"
- dest: "{{ usbdrive_path }}/"
+ for UEFI these steps need to be done
- - name: Generate syslinux configuration for BIOS boot
- copy:
- dest: "{{ usbdrive_path }}/syslinux.cfg"
- content: |
- DEFAULT linux
- SAY SYSLINUX booting an automated installer for {{ install_hostname }}...
- LABEL linux
- KERNEL linux
- INITRD initrd.preseed.gz
- APPEND install {{ (install.kernel_cmdline | default([])) | join(' ') }}
+ $ 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
- - name: create EFI boot directory
- file:
- path: "{{ usbdrive_path }}/EFI/boot"
- state: directory
+ This will NOT be done automatically.
- - name: Generate syslinux configuration for UEFI boot
- copy:
- dest: "{{ usbdrive_path }}/EFI/boot/syslinux.cfg"
- content: |
- DEFAULT linux
- SAY SYSLINUX booting an automated installer for {{ install_hostname }}...
- LABEL linux
- KERNEL ../../linux
- INITRD ../../initrd.preseed.gz
- APPEND install {{ (install.kernel_cmdline | default([])) | join(' ') }}
+- 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.
- - name: Make the USB disk bootable
- pause:
- seconds: 0
- prompt: |
- You should make sure the USB disk is bootable and
- has syslinux installed.
+ ## 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
- $ 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.]
+ - name: clear all gathered facts
+ meta: clear_facts
- for UEFI these steps need to be done
+ - name: wait for vm to start up
+ wait_for_connection:
+ delay: 5
+ timeout: 120
- $ sudo apt install syslinux-efi
- $ cp /usr/lib/syslinux/modules/efi64/* {{ usbdrive_path }}/EFI/boot/
- $ cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi {{ usbdrive_path }}/EFI/boot/bootx64.efi
+ - name: reenable StrictHostKeyChecking
+ set_fact:
+ ansible_ssh_extra_args: ""
- This will NOT be done automatically.
+- 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 }}"