Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added usb support to proxmox module #8199

Merged
merged 8 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -517,6 +517,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 @@ -1091,7 +1101,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 @@ -1308,6 +1318,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 @@ -1513,6 +1524,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
Loading