Skip to content

Commit

Permalink
added usb support to proxmox module (#8199)
Browse files Browse the repository at this point in the history
* added usb support to proxmox module

* forgot docs

* fixed net refrances

* changed usb to USB

* added changelog fragment

Co-authored-by: Felix Fontein <felix@fontein.de>

* added changelog fragment

* corrected spelling and punctuation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Another one.

---------

Co-authored-by: ripplefcl <ripple@ripplefcl.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
3 people authored May 20, 2024
1 parent bebe162 commit 861f55e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "proxmox_kvm - adds``usb`` parameter for setting USB devices on proxmox KVM VMs (https://github.com/ansible-collections/community.general/pull/8199)."
14 changes: 13 additions & 1 deletion plugins/modules/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@
default: '2.0'
type: dict
version_added: 7.1.0
usb:
description:
- A hash/dictionary of USB devices for the VM. O(usb='{"key":"value", "key":"value"}').
- Keys allowed are - C(usb[n]) where 0 ≤ n ≤ N.
- Values allowed are - C(host="value|spice",mapping="value",usb3="1|0").
- host is either C(spice) or the USB id/port.
- Option C(mapping) is the mapped USB device name.
- Option C(usb3) enables USB 3 support.
type: dict
version_added: 9.0.0
update:
description:
- If V(true), the VM will be updated with new value.
Expand Down Expand Up @@ -1094,7 +1104,7 @@ def create_vm(self, vmid, newid, node, name, memory, cpu, cores, sockets, update
)

# Convert all dict in kwargs to elements.
# For hostpci[n], ide[n], net[n], numa[n], parallel[n], sata[n], scsi[n], serial[n], virtio[n], ipconfig[n]
# For hostpci[n], ide[n], net[n], numa[n], parallel[n], sata[n], scsi[n], serial[n], virtio[n], ipconfig[n], usb[n]
for k in list(kwargs.keys()):
if isinstance(kwargs[k], dict):
kwargs.update(kwargs[k])
Expand Down Expand Up @@ -1311,6 +1321,7 @@ def main():
storage=dict(type='str', required=True),
version=dict(type='str', choices=['2.0', '1.2'], default='2.0')
)),
usb=dict(type='dict'),
update=dict(type='bool', default=False),
update_unsafe=dict(type='bool', default=False),
vcpus=dict(type='int'),
Expand Down Expand Up @@ -1516,6 +1527,7 @@ def main():
tdf=module.params['tdf'],
template=module.params['template'],
tpmstate0=module.params['tpmstate0'],
usb=module.params['usb'],
vcpus=module.params['vcpus'],
vga=module.params['vga'],
virtio=module.params['virtio'],
Expand Down

0 comments on commit 861f55e

Please sign in to comment.