2024-03-19 23:02:50 +01:00
|
|
|
---
|
|
|
|
- name: Include Packages
|
2024-07-11 22:20:45 +02:00
|
|
|
ansible.builtin.include_vars:
|
2024-03-19 23:02:50 +01:00
|
|
|
file: packages.yml
|
|
|
|
name: role_packages
|
|
|
|
|
|
|
|
- name: Run OS-specific bootstrap process
|
|
|
|
block:
|
|
|
|
- name: Bootstrap RHEL System
|
2024-10-30 00:29:46 +01:00
|
|
|
block:
|
|
|
|
- name: Install base packages in chroot environment
|
|
|
|
ansible.builtin.command: >-
|
|
|
|
dnf --releasever={{ '8' if os == 'rhel8' else '9' }} --repo={{ os | lower }}-baseos
|
|
|
|
--installroot=/mnt
|
|
|
|
--setopt=install_weak_deps=False --setopt=optional_metadata_types=filelists
|
|
|
|
groupinstall -y base core
|
|
|
|
changed_when: result.rc == 0
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Prepare chroot environment
|
|
|
|
ansible.builtin.shell: |
|
|
|
|
ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf
|
|
|
|
mkdir -p /mnt/usr/local/install/redhat/dvd
|
|
|
|
mount --bind /usr/local/install/redhat/dvd /mnt/usr/local/install/redhat/dvd
|
|
|
|
arch-chroot /mnt rpm --rebuilddb
|
|
|
|
changed_when: result.rc == 0
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Copy RHEL repo file into chroot environment
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /etc/yum.repos.d/{{ os | lower }}.repo
|
|
|
|
dest: /mnt/etc/yum.repos.d/{{ os | lower }}.repo
|
|
|
|
mode: '0644'
|
|
|
|
remote_src: true
|
|
|
|
|
|
|
|
- name: Install additional packages in chroot
|
|
|
|
ansible.builtin.command: >-
|
|
|
|
arch-chroot /mnt dnf --releasever={{ '8' if os == 'rhel8' else '9' }}
|
|
|
|
--setopt=install_weak_deps=False install -y {{ role_packages[os] | join(' ') }}
|
|
|
|
changed_when: result.rc == 0
|
|
|
|
register: result
|