- Generate resolv.conf from inventory DNS settings instead of copying host file (Arch ISO has systemd-resolved stub 127.0.0.53) - Add XFS compat options for GRUB 2.06 and kernel 5.14 across LVM volumes, /boot partition, and data disks - Mount API filesystems (proc, sys, dev) into chroot for RPM scriptlets - Bypass GPG Sequoia validation with _pkgverify_level none - Tolerate grub2-common scriptlet warnings - Handle libvirt VM destroy gracefully during cleanup
90 lines
2.9 KiB
YAML
90 lines
2.9 KiB
YAML
---
|
|
- name: Determine additional disks to auto-mount
|
|
ansible.builtin.set_fact:
|
|
partitioning_extra_disks: >-
|
|
{{
|
|
(system_cfg.disks | default([]))[1:]
|
|
| selectattr('mount.path')
|
|
| list
|
|
}}
|
|
changed_when: false
|
|
|
|
- name: Validate additional disks do not target install_drive
|
|
when: partitioning_extra_disks | length > 0
|
|
ansible.builtin.assert:
|
|
that:
|
|
- item.device is defined
|
|
- item.device | string | length > 0
|
|
- item.device != install_drive
|
|
- item.partition is defined
|
|
- item.partition | string | length > 0
|
|
- item.mount.fstype is defined
|
|
- item.mount.fstype in ['btrfs', 'ext4', 'xfs']
|
|
- item.mount.path is defined
|
|
- item.mount.path | string | length > 0
|
|
- item.mount.path.startswith('/')
|
|
- item.mount.path != '/'
|
|
fail_msg: "Invalid additional disk definition: {{ item | to_json }}"
|
|
quiet: true
|
|
loop: "{{ partitioning_extra_disks }}"
|
|
loop_control:
|
|
label: "{{ item | to_json }}"
|
|
|
|
- name: Partition additional disks
|
|
when: partitioning_extra_disks | length > 0
|
|
community.general.parted:
|
|
device: "{{ item.device }}"
|
|
label: gpt
|
|
number: 1
|
|
part_start: "1MiB"
|
|
part_end: "100%"
|
|
name: "{{ (item.mount.label | default('') | string | length > 0) | ternary(item.mount.label, 'data') }}"
|
|
state: present
|
|
loop: "{{ partitioning_extra_disks }}"
|
|
loop_control:
|
|
label: "{{ item.device }}"
|
|
|
|
- name: Settle partition tables for additional disks
|
|
when: partitioning_extra_disks | length > 0
|
|
ansible.builtin.command: udevadm settle
|
|
changed_when: false
|
|
|
|
- name: Create filesystems on additional disks
|
|
when: partitioning_extra_disks | length > 0
|
|
vars:
|
|
_label_opt: "{{ ('-L ' ~ item.mount.label) if (item.mount.label | default('') | string | length) > 0 else '' }}"
|
|
_compat_opt: "{{ '-m bigtime=0 -i nrext64=0,exchange=0 -n parent=0' if (is_rhel | bool and item.mount.fstype == 'xfs') else '' }}"
|
|
_all_opts: "{{ ([_label_opt, _compat_opt] | select | join(' ')) or omit }}"
|
|
community.general.filesystem:
|
|
dev: "{{ item.partition }}"
|
|
fstype: "{{ item.mount.fstype }}"
|
|
opts: "{{ _all_opts }}"
|
|
force: true
|
|
loop: "{{ partitioning_extra_disks }}"
|
|
loop_control:
|
|
label: "{{ item.partition }}"
|
|
|
|
- name: Ensure mount directories exist for additional disks
|
|
when: partitioning_extra_disks | length > 0
|
|
ansible.builtin.file:
|
|
path: "/mnt{{ item.mount.path }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
loop: "{{ partitioning_extra_disks }}"
|
|
loop_control:
|
|
label: "{{ item.mount.path }}"
|
|
|
|
- name: Mount additional disks for fstab generation
|
|
when: partitioning_extra_disks | length > 0
|
|
ansible.posix.mount:
|
|
path: "/mnt{{ item.mount.path }}"
|
|
src: "{{ item.partition }}"
|
|
fstype: "{{ item.mount.fstype }}"
|
|
opts: "{{ item.mount.opts | default('defaults') }}"
|
|
state: mounted
|
|
loop: "{{ partitioning_extra_disks }}"
|
|
loop_control:
|
|
label: "{{ item.mount.path }}"
|