diff --git a/roles/cleanup/tasks/proxmox.yml b/roles/cleanup/tasks/proxmox.yml index cd3cec2..57f0181 100644 --- a/roles/cleanup/tasks/proxmox.yml +++ b/roles/cleanup/tasks/proxmox.yml @@ -13,7 +13,6 @@ api_user: "{{ hypervisor_cfg.username }}" api_password: "{{ hypervisor_cfg.password }}" node: "{{ hypervisor_cfg.host }}" - no_log: true block: - name: Cleanup Setup Disks community.proxmox.proxmox_disk: @@ -21,10 +20,13 @@ vmid: "{{ system_cfg.id }}" disk: "{{ item }}" state: absent - loop: - - ide0 - - ide2 + loop: >- + {{ + ['ide0', 'ide2'] + + (['ide1'] if not (os == 'rhel' and system_cfg.features.rhel_repo.source == 'iso') else []) + }} failed_when: false + no_log: true - name: Start the VM community.proxmox.proxmox_kvm: diff --git a/roles/cleanup/tasks/vmware.yml b/roles/cleanup/tasks/vmware.yml index 7118c29..3dc1ea7 100644 --- a/roles/cleanup/tasks/vmware.yml +++ b/roles/cleanup/tasks/vmware.yml @@ -44,7 +44,8 @@ 'state': 'absent' } ] - if rhel_iso is defined and rhel_iso | length > 0 + if (rhel_iso is defined and rhel_iso | length > 0 + and not (os == 'rhel' and system_cfg.features.rhel_repo.source == 'iso')) else [] ) }} diff --git a/roles/configuration/tasks/fstab.yml b/roles/configuration/tasks/fstab.yml index d213706..da82670 100644 --- a/roles/configuration/tasks/fstab.yml +++ b/roles/configuration/tasks/fstab.yml @@ -23,8 +23,19 @@ regexp: "(xfs.*?)(attr2)" replace: "\\1allocsize=64m" +- name: Remove RHEL ISO fstab entry when not using local repo + when: + - os == "rhel" + - system_cfg.features.rhel_repo.source != "iso" + ansible.builtin.lineinfile: + path: /mnt/etc/fstab + regexp: "^.*\\/dvd.*$" + state: absent + - name: Replace ISO UUID entry with /dev/sr0 in fstab - when: os == "rhel" + when: + - os == "rhel" + - system_cfg.features.rhel_repo.source == "iso" vars: configuration_fstab_dvd_line: >- {{ @@ -39,7 +50,10 @@ state: present - name: Write image from RHEL ISO to the target machine - when: os == "rhel" and hypervisor_type == 'vmware' + when: + - os == "rhel" + - hypervisor_type == "vmware" + - system_cfg.features.rhel_repo.source == "iso" ansible.builtin.command: argv: - dd