fix(bootstrap): RHEL 9 bootstrap from Arch ISO compatibility
- 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
This commit is contained in:
@@ -1,4 +1,28 @@
|
|||||||
---
|
---
|
||||||
|
- name: Create API filesystem mountpoints in installroot
|
||||||
|
when: is_rhel | bool
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/mnt/{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
loop:
|
||||||
|
- dev
|
||||||
|
- proc
|
||||||
|
- sys
|
||||||
|
|
||||||
|
- name: Mount API filesystems into installroot
|
||||||
|
when: is_rhel | bool
|
||||||
|
ansible.posix.mount:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
path: "/mnt/{{ item.path }}"
|
||||||
|
fstype: "{{ item.fstype }}"
|
||||||
|
opts: "{{ item.opts | default(omit) }}"
|
||||||
|
state: ephemeral
|
||||||
|
loop:
|
||||||
|
- { src: proc, path: proc, fstype: proc }
|
||||||
|
- { src: sysfs, path: sys, fstype: sysfs }
|
||||||
|
- { src: /dev, path: dev, fstype: none, opts: bind }
|
||||||
|
|
||||||
- name: Run OS-specific bootstrap process
|
- name: Run OS-specific bootstrap process
|
||||||
vars:
|
vars:
|
||||||
bootstrap_os_task_map:
|
bootstrap_os_task_map:
|
||||||
|
|||||||
@@ -9,12 +9,21 @@
|
|||||||
groupinstall -y core base standard
|
groupinstall -y core base standard
|
||||||
register: bootstrap_result
|
register: bootstrap_result
|
||||||
changed_when: bootstrap_result.rc == 0
|
changed_when: bootstrap_result.rc == 0
|
||||||
|
failed_when:
|
||||||
|
- bootstrap_result.rc != 0
|
||||||
|
- "'grub2-common' not in (bootstrap_result.stderr | default(''))"
|
||||||
|
|
||||||
- name: Ensure chroot has resolv.conf
|
- name: Write resolv.conf into chroot
|
||||||
ansible.builtin.file:
|
ansible.builtin.copy:
|
||||||
src: /run/NetworkManager/resolv.conf
|
|
||||||
dest: /mnt/etc/resolv.conf
|
dest: /mnt/etc/resolv.conf
|
||||||
state: link
|
mode: "0644"
|
||||||
|
content: |
|
||||||
|
{% for dns in system_cfg.network.dns.servers %}
|
||||||
|
nameserver {{ dns }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if system_cfg.network.dns.search | default([]) | length > 0 %}
|
||||||
|
search {{ system_cfg.network.dns.search | join(' ') }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
- name: Ensure chroot RHEL DVD directory exists
|
- name: Ensure chroot RHEL DVD directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
community.libvirt.virt:
|
community.libvirt.virt:
|
||||||
name: "{{ hostname }}"
|
name: "{{ hostname }}"
|
||||||
state: destroyed
|
state: destroyed
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
- name: Start the VM
|
- name: Start the VM
|
||||||
community.libvirt.virt:
|
community.libvirt.virt:
|
||||||
|
|||||||
@@ -205,6 +205,13 @@
|
|||||||
opts: "ro,loop"
|
opts: "ro,loop"
|
||||||
state: mounted
|
state: mounted
|
||||||
|
|
||||||
|
- name: Relax RPM Sequoia signature policy for RHEL bootstrap
|
||||||
|
when: is_rhel | bool
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/rpm/macros
|
||||||
|
content: "%_pkgverify_level none\n"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Configure RHEL Repos for installation
|
- name: Configure RHEL Repos for installation
|
||||||
when: is_rhel | bool
|
when: is_rhel | bool
|
||||||
block:
|
block:
|
||||||
|
|||||||
@@ -51,10 +51,14 @@
|
|||||||
|
|
||||||
- name: Create filesystems on additional disks
|
- name: Create filesystems on additional disks
|
||||||
when: partitioning_extra_disks | length > 0
|
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:
|
community.general.filesystem:
|
||||||
dev: "{{ item.partition }}"
|
dev: "{{ item.partition }}"
|
||||||
fstype: "{{ item.mount.fstype }}"
|
fstype: "{{ item.mount.fstype }}"
|
||||||
opts: "{{ ('-L ' ~ item.mount.label) if (item.mount.label | default('') | string | length) > 0 else omit }}"
|
opts: "{{ _all_opts }}"
|
||||||
force: true
|
force: true
|
||||||
loop: "{{ partitioning_extra_disks }}"
|
loop: "{{ partitioning_extra_disks }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
|||||||
@@ -418,6 +418,7 @@
|
|||||||
community.general.filesystem:
|
community.general.filesystem:
|
||||||
dev: "{{ install_drive }}{{ partitioning_boot_fs_partition_suffix }}"
|
dev: "{{ install_drive }}{{ 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 }}"
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: Remove unsupported ext4 features from /boot
|
- name: Remove unsupported ext4 features from /boot
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
community.general.filesystem:
|
community.general.filesystem:
|
||||||
dev: /dev/sys/{{ item.lv }}
|
dev: /dev/sys/{{ item.lv }}
|
||||||
fstype: xfs
|
fstype: xfs
|
||||||
|
opts: "{{ '-m bigtime=0 -i nrext64=0,exchange=0 -n parent=0' if is_rhel | bool else omit }}"
|
||||||
force: true
|
force: true
|
||||||
loop:
|
loop:
|
||||||
- { lv: root }
|
- { lv: root }
|
||||||
|
|||||||
Reference in New Issue
Block a user