Skip to content
Snippets Groups Projects
Verified Commit 040a7838 authored by Evangelos Foutras's avatar Evangelos Foutras :smiley_cat:
Browse files

Merge branch 'skip-uefi-for-vms' into 'master'

install_arch: skip UEFI partition on cloud servers

See merge request !857
parents 542af5f0 32a89708
No related branches found
No related tags found
1 merge request!857install_arch: skip UEFI partition on cloud servers
Pipeline #104030 passed
......@@ -35,7 +35,9 @@
--align-end
--clear
--new=0:0:+1M --change-name=0:'BIOS boot partition' --typecode=0:ef02
{% if ansible_virtualization_role == 'host' %}
--new=0:0:+512M --change-name=0:'EFI system partition' --typecode=0:ef00
{% endif %}
--new=0:0:0 --change-name=0:root --typecode=0:8304
{{ item }}
with_items:
......@@ -43,26 +45,33 @@
register: sgdisk
changed_when: "sgdisk.rc == 0"
- name: Format the EFI system partition # noqa no-changed-when
command: mkfs.fat -F 32 -S 4096 -n ESP {{ system_disks[0] }}{{ 'p2' if 'nvme' in system_disks[0] else '2' }}
- name: Store root partition number for later steps
set_fact:
root_partno: "{{ '3' if ansible_virtualization_role == 'host' else '2' }}"
- name: Partition and format the disks (btrfs RAID) # noqa no-changed-when
command: mkfs.btrfs -f -L root -d {{ raid_level | default('raid1') }} -m {{ raid_level | default('raid1') }} -O no-holes {{ system_disks | map('regex_replace', '^(.*)$', '\g<1>p3' if 'nvme' in system_disks[0] else '\g<1>3') | join(' ') }}
command: mkfs.btrfs -f -L root -d {{ raid_level | default('raid1') }} -m {{ raid_level | default('raid1') }} -O no-holes {{ system_disks | map('regex_replace', '^(.*)$', '\g<1>p' ~ root_partno if 'nvme' in system_disks[0] else '\g<1>' ~ root_partno) | join(' ') }}
when: filesystem == "btrfs" and system_disks | length >= 2
- name: Partition and format the disks (btrfs single) # noqa no-changed-when
command: mkfs.btrfs -f -L root -d single -m single -O no-holes {{ system_disks[0] }}{{ 'p3' if 'nvme' in system_disks[0] else '3' }}
command: mkfs.btrfs -f -L root -d single -m single -O no-holes {{ system_disks[0] }}{{ 'p' if 'nvme' in system_disks[0] }}{{ root_partno }}
when: filesystem == "btrfs" and system_disks | length == 1
- name: Mount the filesystem (btrfs)
mount: src="{{ system_disks[0] }}{{ 'p3' if 'nvme' in system_disks[0] else '3' }}" path=/mnt state=mounted fstype=btrfs opts="compress-force=zstd,space_cache=v2"
mount: src="{{ system_disks[0] }}{{ 'p' if 'nvme' in system_disks[0] }}{{ root_partno }}" path=/mnt state=mounted fstype=btrfs opts="compress-force=zstd,space_cache=v2"
when: filesystem == "btrfs"
- name: Create the efi mountpoint
file: path=/mnt/efi state=directory mode='0755'
- name: Format and mount the EFI system partition
when: ansible_virtualization_role == 'host'
block:
- name: Format the EFI system partition # noqa no-changed-when
command: mkfs.fat -F 32 -S 4096 -n ESP {{ system_disks[0] }}{{ 'p2' if 'nvme' in system_disks[0] else '2' }}
- name: Create the efi mountpoint
file: path=/mnt/efi state=directory mode='0755'
- name: Mount the efi filesystem
mount: src="{{ system_disks[0] }}{{ 'p2' if 'nvme' in system_disks[0] else '2' }}" path=/mnt/efi state=mounted fstype=vfat
- name: Mount the efi filesystem
mount: src="{{ system_disks[0] }}{{ 'p2' if 'nvme' in system_disks[0] else '2' }}" path=/mnt/efi state=mounted fstype=vfat
- name: Touch LOCK file on mountpoint
file: path=/mnt/LOCK state=touch owner=root group=root mode=0644
......@@ -120,7 +129,7 @@
changed_when: "chroot_pacman_key_populate.rc == 0"
- name: Install ucode update
when: ansible_virtualization_role == "host"
when: ansible_virtualization_role == 'host'
block:
- name: Install ucode update for Intel
set_fact: ucode="intel-ucode"
......@@ -183,6 +192,7 @@
- "{{ system_disks }}"
register: chroot_grub_install_uefi
changed_when: "chroot_grub_install_uefi.rc == 0"
when: ansible_virtualization_role == 'host'
- name: Configure grub
command: chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment