mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #6533/01f21b1d backport][stable-7] proxmox_kvm: support for tpmstate0 parameter (#6600)
proxmox_kvm: support for tpmstate0 parameter (#6533) * proxmox_kvm: added support for tmpstate adds hash of options for a TPM state disk, which is required for Windows 11 installations * updated wrong version in docs * bump version 7.1.0 -> 7.1.1 * fixed parameter name typo * updated to pass sanity; assumed version_added to be next major (7.2.0) * replaced 'tpmstate' with 'tpmstate0'; added suboptions to kvm_args * fixed line too long * use get() instead of pop() to preserve verbose invocation.module_args * update comment to include tpmstate0 * added changelog fragment * Revert "bump version 7.1.0 -> 7.1.1" This reverts commit772ed98dba
. * Include PR link in changelog fragment Co-authored-by: Felix Fontein <felix@fontein.de> * Corrected version_added Co-authored-by: Felix Fontein <felix@fontein.de> * corrected semantic markup for option name Co-authored-by: Felix Fontein <felix@fontein.de> * set suboptions of tpmstate0 to required * set default for tpmstate0.version (2.0) * fixed typo Co-authored-by: Felix Fontein <felix@fontein.de> * wrapped default version string in quotes Co-authored-by: Felix Fontein <felix@fontein.de> * Improve changelog formatting. --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit01f21b1d46
) Co-authored-by: Jeff Turner <jeff@torusoft.com>
This commit is contained in:
parent
c4ebd482eb
commit
307a291b57
2 changed files with 36 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- proxmox_kvm - added support for ``tpmstate0`` parameter to configure TPM (Trusted Platform Module) disk. TPM is required for Windows 11 installations (https://github.com/ansible-collections/community.general/pull/6533).
|
|
@ -482,6 +482,24 @@ options:
|
||||||
- Timeout for operations.
|
- Timeout for operations.
|
||||||
type: int
|
type: int
|
||||||
default: 30
|
default: 30
|
||||||
|
tpmstate0:
|
||||||
|
description:
|
||||||
|
- A hash/dictionary of options for the Trusted Platform Module disk.
|
||||||
|
- A TPM state disk is required for Windows 11 installations.
|
||||||
|
suboptions:
|
||||||
|
storage:
|
||||||
|
description:
|
||||||
|
- O(tpmstate0.storage) is the storage identifier where to create the disk.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
description:
|
||||||
|
- The TPM version to use.
|
||||||
|
type: str
|
||||||
|
choices: ['1.2', '2.0']
|
||||||
|
default: '2.0'
|
||||||
|
type: dict
|
||||||
|
version_added: 7.1.0
|
||||||
update:
|
update:
|
||||||
description:
|
description:
|
||||||
- If C(true), the VM will be updated with new value.
|
- If C(true), the VM will be updated with new value.
|
||||||
|
@ -938,7 +956,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
urlencoded_ssh_keys = quote(kwargs['sshkeys'], safe='')
|
urlencoded_ssh_keys = quote(kwargs['sshkeys'], safe='')
|
||||||
kwargs['sshkeys'] = str(urlencoded_ssh_keys)
|
kwargs['sshkeys'] = str(urlencoded_ssh_keys)
|
||||||
|
|
||||||
# If update, don't update disk (virtio, efidisk0, ide, sata, scsi) and network interface
|
# If update, don't update disk (virtio, efidisk0, tpmstate0, ide, sata, scsi) and network interface
|
||||||
# pool parameter not supported by qemu/<vmid>/config endpoint on "update" (PVE 6.2) - only with "create"
|
# pool parameter not supported by qemu/<vmid>/config endpoint on "update" (PVE 6.2) - only with "create"
|
||||||
if update:
|
if update:
|
||||||
if 'virtio' in kwargs:
|
if 'virtio' in kwargs:
|
||||||
|
@ -951,6 +969,8 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
del kwargs['ide']
|
del kwargs['ide']
|
||||||
if 'efidisk0' in kwargs:
|
if 'efidisk0' in kwargs:
|
||||||
del kwargs['efidisk0']
|
del kwargs['efidisk0']
|
||||||
|
if 'tpmstate0' in kwargs:
|
||||||
|
del kwargs['tpmstate0']
|
||||||
if 'net' in kwargs:
|
if 'net' in kwargs:
|
||||||
del kwargs['net']
|
del kwargs['net']
|
||||||
if 'force' in kwargs:
|
if 'force' in kwargs:
|
||||||
|
@ -978,6 +998,13 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
if 'storage' != k])
|
if 'storage' != k])
|
||||||
kwargs['efidisk0'] = efidisk0_str
|
kwargs['efidisk0'] = efidisk0_str
|
||||||
|
|
||||||
|
# Flatten tpmstate0 option to a string so that it's a string which is what Proxmoxer and the API expect
|
||||||
|
if 'tpmstate0' in kwargs:
|
||||||
|
kwargs['tpmstate0'] = '{storage}:1,version=v{version}'.format(
|
||||||
|
storage=kwargs['tpmstate0'].get('storage'),
|
||||||
|
version=kwargs['tpmstate0'].get('version')
|
||||||
|
)
|
||||||
|
|
||||||
# Convert all dict in kwargs to elements.
|
# 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]
|
||||||
for k in list(kwargs.keys()):
|
for k in list(kwargs.keys()):
|
||||||
|
@ -1163,6 +1190,11 @@ def main():
|
||||||
tdf=dict(type='bool'),
|
tdf=dict(type='bool'),
|
||||||
template=dict(type='bool'),
|
template=dict(type='bool'),
|
||||||
timeout=dict(type='int', default=30),
|
timeout=dict(type='int', default=30),
|
||||||
|
tpmstate0=dict(type='dict',
|
||||||
|
options=dict(
|
||||||
|
storage=dict(type='str', required=True),
|
||||||
|
version=dict(type='str', choices=['2.0', '1.2'], default='2.0')
|
||||||
|
)),
|
||||||
update=dict(type='bool', default=False),
|
update=dict(type='bool', default=False),
|
||||||
vcpus=dict(type='int'),
|
vcpus=dict(type='int'),
|
||||||
vga=dict(choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']),
|
vga=dict(choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']),
|
||||||
|
@ -1356,6 +1388,7 @@ def main():
|
||||||
target=module.params['target'],
|
target=module.params['target'],
|
||||||
tdf=module.params['tdf'],
|
tdf=module.params['tdf'],
|
||||||
template=module.params['template'],
|
template=module.params['template'],
|
||||||
|
tpmstate0=module.params['tpmstate0'],
|
||||||
vcpus=module.params['vcpus'],
|
vcpus=module.params['vcpus'],
|
||||||
vga=module.params['vga'],
|
vga=module.params['vga'],
|
||||||
virtio=module.params['virtio'],
|
virtio=module.params['virtio'],
|
||||||
|
|
Loading…
Reference in a new issue