Fix ISO mounting for VMware Hypervisor

This commit is contained in:
Sandwich 2024-10-30 20:25:41 +01:00
parent 173ecd299b
commit e5660b0ba7
2 changed files with 16 additions and 2 deletions

View File

@ -30,11 +30,17 @@
name: "{{ hostname }}" name: "{{ hostname }}"
cdrom: cdrom:
- controller_number: 0 - controller_number: 0
unit_number: 1 unit_number: 0
controller_type: sata controller_type: sata
type: iso type: iso
iso_path: "{{ boot_iso }}" iso_path: "{{ boot_iso }}"
state: absent state: absent
- controller_number: 0
unit_number: 1
controller_type: sata
type: iso
iso_path: "{{ rhel_iso | default(omit) }}"
state: absent
- name: Remove Archiso and cloud-init disks - name: Remove Archiso and cloud-init disks
when: hypervisor == "libvirt" when: hypervisor == "libvirt"

View File

@ -18,10 +18,18 @@
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /mnt/etc/fstab path: /mnt/etc/fstab
regexp: '^.*\/dvd.*$' regexp: '^.*\/dvd.*$'
line: "/dev/sr0 /usr/local/install/redhat/dvd iso9660 ro,relatime,nojoliet,check=s,map=n 0 0" line: "{{ '/usr/local/install/redhat/rhel.iso /usr/local/install/redhat/dvd iso9660 loop,nofail 0 0' if hypervisor == 'vmware'
else '/dev/sr0 /usr/local/install/redhat/dvd iso9660 ro,relatime,nojoliet,check=s,map=n,nofail 0 0' }}"
state: present state: present
backrefs: true backrefs: true
- name: Write image from RHEL ISO to the target machine
ansible.builtin.command: >
"dd if={{ '/dev/sr1' if hypervisor == 'vmware' else '/dev/sr2' }}
of=/mnt/usr/local/install/redhat/rhel.iso bs=4M status=progress"
changed_when: result.rc == 0
register: result
- name: Append TempFS to fstab - name: Append TempFS to fstab
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /mnt/etc/fstab path: /mnt/etc/fstab