Manage ISO/VHD/VHDX mounts on Windows hosts
- Manages mount behavior for a specified ISO, VHD, or VHDX image on a Windows host. When
state
ispresent
, the image will be mounted under a system-assigned drive letter, which will be returned in themount_path
value of the module result. - Requires Windows 8+ or Windows Server 2012+.
# Run installer from mounted ISO, then unmount
- name: Ensure an ISO is mounted
community.windows.win_disk_image:
image_path: C:\install.iso
state: present
register: disk_image_out
- name: Run installer from mounted ISO
ansible.windows.win_package:
path: '{{ disk_image_out.mount_paths[0] }}setup\setup.exe'
product_id: 35a4e767-0161-46b0-979f-e61f282fee21
state: present
- name: Unmount ISO
community.windows.win_disk_image:
image_path: C:\install.iso
state: absent
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
mount_paths
list
|
when state is present |
A list of filesystem paths mounted from the target image.
Sample:
['E:\\', 'F:\\']
|
- Matt Davis (@nitzmahone)