fix(partitioning): add partition separator for NVMe/mmcblk device paths

This commit is contained in:
2026-02-22 02:39:36 +01:00
parent f7070343b9
commit 59670e876a
2 changed files with 10 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
--- ---
partitioning_btrfs_compress_opt: "{{ 'compress=zstd:15' if system_cfg.features.zstd.enabled | bool else '' }}" partitioning_btrfs_compress_opt: "{{ 'compress=zstd:15' if system_cfg.features.zstd.enabled | bool else '' }}"
# Partition separator: 'p' for NVMe/mmcblk (device path ends in digit), empty for SCSI/virtio.
# Examples: /dev/sda → /dev/sda1, /dev/nvme0n1 → /dev/nvme0n1p1
partitioning_part_sep: "{{ 'p' if (install_drive | default('') | regex_search('\\d$')) else '' }}"
partitioning_boot_partition_suffix: 1 partitioning_boot_partition_suffix: 1
partitioning_main_partition_suffix: 2 partitioning_main_partition_suffix: 2
partitioning_efi_size_mib: 512 partitioning_efi_size_mib: 512
@@ -113,12 +116,12 @@ partitioning_grub_enable_cryptodisk: >-
and not (partitioning_separate_boot | bool) and not (partitioning_separate_boot | bool)
and (partitioning_efi_mountpoint == '/boot/efi') and (partitioning_efi_mountpoint == '/boot/efi')
}} }}
partitioning_luks_device: "{{ install_drive ~ (partitioning_root_partition_suffix | string) }}" partitioning_luks_device: "{{ install_drive ~ partitioning_part_sep ~ (partitioning_root_partition_suffix | string) }}"
partitioning_root_device: >- partitioning_root_device: >-
{{ {{
'/dev/mapper/' + system_cfg.luks.mapper '/dev/mapper/' + system_cfg.luks.mapper
if (system_cfg.luks.enabled | bool) if (system_cfg.luks.enabled | bool)
else install_drive ~ (partitioning_root_partition_suffix | string) else install_drive ~ partitioning_part_sep ~ (partitioning_root_partition_suffix | string)
}} }}
partitioning_disk_size_gb: >- partitioning_disk_size_gb: >-
{{ {{

View File

@@ -3,7 +3,7 @@
block: block:
- name: Create FAT32 filesystem in boot partition - name: Create FAT32 filesystem in boot partition
community.general.filesystem: community.general.filesystem:
dev: "{{ install_drive }}{{ partitioning_boot_partition_suffix }}" dev: "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_partition_suffix }}"
fstype: vfat fstype: vfat
opts: -F32 -n BOOT opts: -F32 -n BOOT
force: true force: true
@@ -11,7 +11,7 @@
- name: Create filesystem for /boot partition - name: Create filesystem for /boot partition
when: partitioning_separate_boot | bool when: partitioning_separate_boot | bool
community.general.filesystem: community.general.filesystem:
dev: "{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}" dev: "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}"
fstype: "{{ partitioning_boot_fs_fstype }}" fstype: "{{ partitioning_boot_fs_fstype }}"
opts: "{{ '-m bigtime=0 -i nrext64=0,exchange=0 -n parent=0' if (is_rhel | bool and partitioning_boot_fs_fstype == 'xfs') else omit }}" opts: "{{ '-m bigtime=0 -i nrext64=0,exchange=0 -n parent=0' if (is_rhel | bool and partitioning_boot_fs_fstype == 'xfs') else omit }}"
force: true force: true
@@ -23,7 +23,7 @@
- os in ['almalinux', 'rocky', 'rhel'] or (os == 'debian' and (os_version | string) == '11') - os in ['almalinux', 'rocky', 'rhel'] or (os == 'debian' and (os_version | string) == '11')
ansible.builtin.command: >- ansible.builtin.command: >-
tune2fs -O "^orphan_file,^metadata_csum_seed" tune2fs -O "^orphan_file,^metadata_csum_seed"
"{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}" "{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}"
register: partitioning_boot_ext4_tune_result register: partitioning_boot_ext4_tune_result
changed_when: false changed_when: false
@@ -39,7 +39,7 @@
ansible.builtin.include_tasks: "{{ system_cfg.filesystem }}.yml" ansible.builtin.include_tasks: "{{ system_cfg.filesystem }}.yml"
- name: Get UUID for boot filesystem - name: Get UUID for boot filesystem
ansible.builtin.command: blkid -s UUID -o value '{{ install_drive }}{{ partitioning_boot_partition_suffix }}' ansible.builtin.command: blkid -s UUID -o value '{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_partition_suffix }}'
register: partitioning_boot_uuid register: partitioning_boot_uuid
changed_when: false changed_when: false
failed_when: partitioning_boot_uuid.rc != 0 or (partitioning_boot_uuid.stdout | trim | length) == 0 failed_when: partitioning_boot_uuid.rc != 0 or (partitioning_boot_uuid.stdout | trim | length) == 0
@@ -47,7 +47,7 @@
- name: Get UUID for /boot filesystem - name: Get UUID for /boot filesystem
when: partitioning_separate_boot | bool when: partitioning_separate_boot | bool
ansible.builtin.command: >- ansible.builtin.command: >-
blkid -s UUID -o value '{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}' blkid -s UUID -o value '{{ install_drive }}{{ partitioning_part_sep }}{{ partitioning_boot_fs_partition_suffix }}'
register: partitioning_boot_fs_uuid register: partitioning_boot_fs_uuid
changed_when: false changed_when: false
failed_when: partitioning_boot_fs_uuid.rc != 0 or (partitioning_boot_fs_uuid.stdout | trim | length) == 0 failed_when: partitioning_boot_fs_uuid.rc != 0 or (partitioning_boot_fs_uuid.stdout | trim | length) == 0