diff --git a/changelogs/fragments/7872-proxmox_fix update if setting doesnt exist.yaml b/changelogs/fragments/7872-proxmox_fix update if setting doesnt exist.yaml new file mode 100644 index 0000000000..82b4fe31d9 --- /dev/null +++ b/changelogs/fragments/7872-proxmox_fix update if setting doesnt exist.yaml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox - fix updating a container config if the setting does not already exist (https://github.com/ansible-collections/community.general/pull/7872). diff --git a/plugins/modules/proxmox.py b/plugins/modules/proxmox.py index f47ae26e10..2d7b76fde2 100644 --- a/plugins/modules/proxmox.py +++ b/plugins/modules/proxmox.py @@ -562,6 +562,10 @@ class ProxmoxLxcAnsible(ProxmoxAnsible): # compare the requested config against the current update_config = False for (arg, value) in kwargs.items(): + # if the arg isn't in the current config, it needs to be updated + if arg not in current_config: + update_config = True + break # some values are lists, the order isn't always the same, so split them and compare by key if isinstance(value, str): current_values = current_config[arg].split(",")