The Ansible task that I use to mount ISO images on Windows sometimes fails.
openstack: TASK [Ensure an ISO is mounted] ************************************************
openstack: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No file>: line 54
openstack: fatal: [10.0.134.144]: FAILED! => changed=false
openstack: msg: 'Unhandled exception while executing module: The property ''DriveLetter'' cannot be found on this object. Verify that the property exists.'
I call the Ansible task like this.
- name: Ensure an ISO is mounted
community.windows.win_disk_image:
image_path: '{{tempfile.path}}/en_visual_studio_express_2013_for_windows_with_update_5_x86_dvd_6815614.iso'
state: present
register: disk_image_out
retries: 5
delay: 3
Line 54 in the PowerShell script that backs the ansible task seems to be https://github.com/ansible-collections/community.windows/blob/0f1082c372d4351751de360c1f86728adbd4386a/plugins/modules/win_disk_image.ps1#L54
# ISO, we can get the mountpoint directly from Get-Volume
$drive_letters = ($di | Get-Volume).DriveLetter
Is the PowerShell script missing a necessary wait/retry to get the DriveLetter reliably? Why doesn't ansible retry the mount task, given that I specify retries: 5, delay: 3 in the yaml?