proxmox_kvm: add support for ciupgrade parameter (#9066)

* proxmox_kvm: add support for ciupgrade parameter

* add changelog fragment

* proxmox_kvm: version_added specifier for ciupgrade parameter

* proxmox_kvm: remove default value from docs for ciupgrade parameter
pull/9073/head
Robzz 2024-10-28 21:13:06 +01:00 committed by GitHub
parent 67d1b6c413
commit 9069f673e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,2 @@
minor_changes:
- proxmox_kvm - adds the ``ciupgrade`` parameter to specify whether cloud-init should upgrade system packages at first boot (https://github.com/ansible-collections/community.general/pull/9066).

View File

@ -86,6 +86,11 @@ options:
type: str type: str
choices: ['nocloud', 'configdrive2'] choices: ['nocloud', 'configdrive2']
version_added: 1.3.0 version_added: 1.3.0
ciupgrade:
description:
- 'cloud-init: do an automatic package upgrade after the first boot.'
type: bool
version_added: 10.0.0
ciuser: ciuser:
description: description:
- 'cloud-init: username of default user to create.' - 'cloud-init: username of default user to create.'
@ -984,6 +989,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
# Available only in PVE 4 # Available only in PVE 4
only_v4 = ['force', 'protection', 'skiplock'] only_v4 = ['force', 'protection', 'skiplock']
only_v6 = ['ciuser', 'cipassword', 'sshkeys', 'ipconfig', 'tags'] only_v6 = ['ciuser', 'cipassword', 'sshkeys', 'ipconfig', 'tags']
only_v8 = ['ciupgrade']
# valid clone parameters # valid clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target'] valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
@ -1012,6 +1018,12 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
if p in kwargs: if p in kwargs:
del kwargs[p] del kwargs[p]
# The features work only on PVE 8
if pve_major_version < 8:
for p in only_v8:
if p in kwargs:
del kwargs[p]
# 'sshkeys' param expects an urlencoded string # 'sshkeys' param expects an urlencoded string
if 'sshkeys' in kwargs: if 'sshkeys' in kwargs:
urlencoded_ssh_keys = quote(kwargs['sshkeys'], safe='') urlencoded_ssh_keys = quote(kwargs['sshkeys'], safe='')
@ -1207,6 +1219,7 @@ def main():
cicustom=dict(type='str'), cicustom=dict(type='str'),
cipassword=dict(type='str', no_log=True), cipassword=dict(type='str', no_log=True),
citype=dict(type='str', choices=['nocloud', 'configdrive2']), citype=dict(type='str', choices=['nocloud', 'configdrive2']),
ciupgrade=dict(type='bool'),
ciuser=dict(type='str'), ciuser=dict(type='str'),
clone=dict(type='str'), clone=dict(type='str'),
cores=dict(type='int'), cores=dict(type='int'),
@ -1414,6 +1427,7 @@ def main():
cicustom=module.params['cicustom'], cicustom=module.params['cicustom'],
cipassword=module.params['cipassword'], cipassword=module.params['cipassword'],
citype=module.params['citype'], citype=module.params['citype'],
ciupgrade=module.params['ciupgrade'],
ciuser=module.params['ciuser'], ciuser=module.params['ciuser'],
cpulimit=module.params['cpulimit'], cpulimit=module.params['cpulimit'],
cpuunits=module.params['cpuunits'], cpuunits=module.params['cpuunits'],