diff --git a/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml b/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml new file mode 100644 index 0000000000..062ff4c6d7 --- /dev/null +++ b/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_disk - fix unable to create ``cdrom`` media due to ``size`` always being appended (https://github.com/ansible-collections/community.general/pull/6770). diff --git a/plugins/modules/proxmox_disk.py b/plugins/modules/proxmox_disk.py index 8b158e7062..e80b4f7da9 100644 --- a/plugins/modules/proxmox_disk.py +++ b/plugins/modules/proxmox_disk.py @@ -505,7 +505,9 @@ class ProxmoxDiskAnsible(ProxmoxAnsible): timeout_str = "Reached timeout while importing VM disk. Last line in task before timeout: %s" ok_str = "Disk %s imported into VM %s" else: - config_str = "%s:%s" % (self.module.params["storage"], self.module.params["size"]) + config_str = self.module.params["storage"] + if self.module.params.get("media") != "cdrom": + config_str += ":%s" % (self.module.params["size"]) ok_str = "Disk %s created in VM %s" timeout_str = "Reached timeout while creating VM disk. Last line in task before timeout: %s"