Community.proxmox.proxmox / force option

Hello,

I want to overwrite an existing LXC container, therefore the option “force” is set to true:

    - name: Install / Update LXC
      community.proxmox.proxmox:
        hostname: "{{ inventory_hostname_short | lower }}"
        vmid: 101
        disk_volume:
          storage: "VM-Volumes"
          size: "{{ {'S': '2', 'M': '4', 'L': '8'}[pve_guest_size] }}"  # size in GB
        ostemplate: "prox_file:vztmpl/debian-13-standard_13.1-1_amd64.tar.zst"

        cores: "{{ {'S': 1, 'M': 2, 'L': 4}[pve_guest_size] }}"
        memory: "{{ {'S': 256, 'M': 512, 'L': 1024}[pve_guest_size] }}"
        swap: "{{ {'S': 256, 'M': 512, 'L': 1024}[pve_guest_size] }}"
        password: "{{ root_pass }}"
        pubkey: "{{ authorized_keys | join('\n') }}"
        force: true

My expectation would be, that the container is rewritten, but I get a error:

TASK [pve_guest : Install / Update LXC] **************************************************************************************
fatal: [test-lxc -> localhost]: FAILED! => {
    "changed": false
}

MSG:

An error occurred: 500 Internal Server Error: CT 101 already exists on node 'pve1'

Is it a bug or intended behavior? According to the docs it should overwrite the existing container?

Tanks a lot!
Thomas

Hi @DengelFred

Can you provide some version details please so I can try and replicate it?

  • PVE version
  • community.proxmox collection version.

Thanks.

Hello,

community.proxmox => 1.3.0, pve => 8.4.14.
It seems it’s a issue on proxmox, same behavior on cli …

Thomas

Hi there,

Sounds to me that you’re running into this:

While technically correct, I think the assumption of most users of this module is when force is set, that an existing container is deleted before a replacement is deployed. However, I don’t think that’s a part of the module’s logic right now :slight_smile:

1 Like

yes, exactly :face_with_monocle:. But as mentioned, seems to be a bug in the pve api.