diff --git a/roles/cleanup/tasks/main.yml b/roles/cleanup/tasks/main.yml index f7b3de5..6b4a7eb 100644 --- a/roles/cleanup/tasks/main.yml +++ b/roles/cleanup/tasks/main.yml @@ -30,11 +30,17 @@ name: "{{ hostname }}" cdrom: - controller_number: 0 - unit_number: 1 + unit_number: 0 controller_type: sata type: iso iso_path: "{{ boot_iso }}" 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 when: hypervisor == "libvirt" diff --git a/roles/configuration/tasks/main.yml b/roles/configuration/tasks/main.yml index da3d641..e641d4d 100644 --- a/roles/configuration/tasks/main.yml +++ b/roles/configuration/tasks/main.yml @@ -18,10 +18,18 @@ ansible.builtin.lineinfile: path: /mnt/etc/fstab 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 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 ansible.builtin.lineinfile: path: /mnt/etc/fstab