The unmount tasks didn't success but it returned OK, which led to ejecting CDROM failure due to the CDROM is still mounted.
This fix replaced all CDROM mount and unmount task with set_mount_point.yml, and updated the mount_state valid values to: mounted and unmounted. The mounted for ansible.builtin.mount state will be replaced by ephemeral. And both of ephemeral and unmounted state will not change /etc/fstab.
For unmounted state, a waiting task was added to set_mount_point.yml to wait the mount point being absent from ansiblle_mounts fact. I added ignore errors to the waiting task because even if it fails, the eject command would also try to unmount the device firstly and then eject it. The waiting task can provide a pause before ejecting the CDROM device in such case.
The unmount tasks didn't success but it returned OK, which led to ejecting CDROM failure due to the CDROM is still mounted.
This fix replaced all CDROM mount and unmount task with
set_mount_point.yml
, and updated themount_state
valid values to:mounted
andunmounted
. Themounted
for ansible.builtin.mountstate
will be replaced byephemeral
. And both ofephemeral
andunmounted
state will not change /etc/fstab.For
unmounted
state, a waiting task was added toset_mount_point.yml
to wait the mount point being absent from ansiblle_mounts fact. I added ignore errors to the waiting task because even if it fails, theeject
command would also try to unmount the device firstly and then eject it. The waiting task can provide a pause before ejecting the CDROM device in such case.Test passed on RHEL 9.5 Beta: