# Community.proxmox.proxmox / force option

**URL:** <https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515>\
**Category:** Get Help\
**Tags:** proxmox\
**Created:** [September 19, 2025, 10:27am UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515 "2025-09-19T10:27:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [September 19, 2025, 10:27am UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515/1 "2025-09-19T10:27:43Z")

</div>

Hello,

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

```yaml
    - 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:

```plaintext
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

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [September 19, 2025, 4:30pm UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515/2 "2025-09-19T16:30:04Z")

</div>

Hi @DengelFred

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

- PVE version
- `community.proxmox` collection version.

Thanks.

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [September 21, 2025, 6:10pm UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515/3 "2025-09-21T18:10:57Z")

</div>

Hello,

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

Thomas

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [September 23, 2025, 6:14pm UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515/4 "2025-09-23T18:14:28Z")

</div>

Hi there,

Sounds to me that you’re running into this:

> <https://github.com/ansible-collections/community.proxmox/issues/178>
>
> \##### SUMMARY
> According to to \[documentation\](https://docs.ansible.com/ansible/d…evel/collections/community/proxmox/proxmox\_module.html#parameter-force), to replace an existing container, I need to have attributes \`state: present\` and \`force: true\` when calling a \`community.proxmox.proxmox\` task. I set the task accordingly, but it returns an error complaining about that the container already exists. As a workaround I need to delete the container before creating it again.
> 
> \`\`\`log
> fatal: \[mox-node01 -\> localhost\]: FAILED! =\> {
> "changed": false,
> "invocation": {
> "module\_args": {
> # ...
> }
> },
> "msg": "An error occurred: 500 Internal Server Error: CT \<CTID\> already exists on node '\<node name\>'"
> }
> \`\`\`
> 
> \##### ISSUE TYPE
> \- Bug Report
> 
> \##### COMPONENT NAME
> community.proxmox.proxmox
> 
> \##### ANSIBLE VERSION
> \`\`\`
> ansible \[core 2.18.8\]
> config file = None
> configured module search path = \['/home/miguel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'\]
> ansible python module location = /tmp/ansible-venv/lib/python3.11/site-packages/ansible
> ansible collection location = /home/miguel/.ansible/collections:/usr/share/ansible/collections
> executable location = /tmp/ansible-venv/bin/ansible
> python version = 3.11.2 (main, Apr 28 2025, 14:11:48) \[GCC 12.2.0\] (/tmp/ansible-venv/bin/python)
> jinja version = 3.1.6
> libyaml = True
> \`\`\`
> 
> \##### COLLECTION VERSION
> \`\`\`
> ansible-galaxy collection list community.proxmox
> 
> \# /home/miguel/.ansible/collections/ansible\_collections
> Collection Version
> \----------------- -------
> community.proxmox 1.3.0  
> 
> \# /tmp/ansible-venv/lib/python3.11/site-packages/ansible\_collections
> Collection Version
> \----------------- -------
> \`\`\`
> 
> \##### CONFIGURATION
> \`\`\`
> CONFIG\_FILE() = None
> DEFAULT\_TIMEOUT(env: ANSIBLE\_TIMEOUT) = 600
> 
> GALAXY\_SERVERS:
> \`\`\`
> \##### OS / ENVIRONMENT
> Ansible controller:
> Windows 10 
> WSL
> Linux 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT\_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86\_64 GNU/Linux
> 
> Proxmox nodes:
> uname: Linux 6.8.12-11-pve #1 SMP PREEMPT\_DYNAMIC PMX 6.8.12-11 (2025-05-22T09:39Z) x86\_64 GNU/Linux
> pveversion: pve-manager/8.4.1/2a5fa54a8503f96d (running kernel: 6.8.12-11-pve)
> 
> \##### STEPS TO REPRODUCE
> This is the task that is failing. \`container\` is provided based on each yugabyte instance type (vars \`master\` or \`tserver\`). There are 3 hosts. Each host has a master and a tserver, listed in \`hosts\[\].containers\` and each item contains settings specific for that container.
> Inventory:
> \`\`\`yaml
> all:
> vars:
> ansible\_user: \[redacted\]
> api\_user: \[redacted\]
> api\_token\_id: \[redacted\]
> api\_token\_secret: \[redacted\]
> pve\_api\_headers:
> Authorization: "PVEAPIToken={{ api\_user }}!{{ api\_token\_id }}={{ api\_token\_secret }}"
> version: "2024.2.4.0"
> 
> ssh:
> descriptors: \["ansible", "mgmt-client"\]
> path: "{{ inventory\_dir }}/certs"
> pubkeys: "{{ inventory\_dir }}/certs/pubkeys.pub"
> type: ed25519
> 
> service\_name: Yugabyte
> ostemplate: pve-yugabyte\_{{ version }}.tar.gz
> template\_storage: "mox-storage"
> template\_type: "vztmpl"
> base\_tags: "{{ \['yugabyte', 'postgres', 'cassandra', 'intranet', 'nodenet', 'storage', 'db'\] }}"
> backup\_storage: mox-storage
> rcp\_port: "7100"
> private\_subnet: "10.3.1."
> public\_subnet: "10.4.0."
> private\_address: "{{ private\_subnet }}{{ item.ipsuffix }}"
> public\_address: "{{ public\_subnet }}{{ item.ipsuffix }}"
> master\_addresses: \>-
> {{ hostvars
> | dict2items
> | map(attribute='value.containers')
> | select('defined')
> | flatten
> | selectattr('type','equalto','master')
> | map(attribute='ipsuffix')
> | map('regex\_replace','^(.\*)$', private\_subnet ~ '\\1:' ~ rcp\_port)
> | join(',') }}
> 
> public\_addresses: \>-
> {{ hostvars
> | dict2items
> | map(attribute='value.containers')
> | select('defined')
> | flatten
> | map(attribute='ipsuffix')
> | map('regex\_replace','^(.\*)$', public\_subnet ~ '\\1:' ~ rcp\_port)
> | join(',') }}
> 
> container\_fields: &container\_fields
> vmid: "{{ item.vmid }}"
> hostname: "{{ item.hostname }}"
> description: "{{ item.description }}"
> swap: 512
> cores: 4
> password: "\[redacted\]"
> rootfs: 'local-lvm:8'
> netif:
> net0: "name=eth0,bridge=storage,ip={{ private\_address }}/24"
> net1: "name=eth1,bridge=intranet,ip={{ public\_address }}/24"
> # net2: "name=eth2,bridge=nodenet,ip=dhcp"
> 
> master:
> \<\<: \*container\_fields
> tags: "{{ base\_tags + \['ydb-master'\] }}"
> memory: 4000
> mounts:
> mp0: "local-lvm:datafs-{{ item.vmid }}-disk-0,size=32G,mp=/mnt/yugabyte"
> command: "yb-master"
>       
> tserver:
> \<\<: \*container\_fields
> tags: "{{ (item.tags | default(\[\])) | union(base\_tags) | union(\['ydb-tserver'\]) }}"
> 
> memory: 1000
> mounts:
> mp0: "local-lvm:datafs-{{ item.vmid }}-disk-0,size=8G,mp=/mnt/yugabyte"
> command: "yb-tserver"
> 
> hosts:
> mox-node01:
> ansible\_host: 192.168.1.201
> containers:
> - hostname: "mox-db01"
> vmid: 109
> description: "YugabyteDB Master db01"
> ipsuffix: "10"
> type: master
> zone\_id: db01
> tag: db01
> 
> - hostname: "mox-db01-ts01"
> vmid: 204
> description: "YugabyteDB TServer db01-01"
> ipsuffix: "11"
> type: tserver
> zone\_id: db01
> tag: db01
> 
> mox-node02:
> ansible\_host: 192.168.1.202
> containers:
> - hostname: "mox-db02"
> vmid: 202
> description: YugabyteDB Master db02
> ipsuffix: "20"
> type: master
> zone\_id: db02
> tag: db02
> 
> #...
> \`\`\`
> 
> Tasks:
> \`\`\`yaml
> \- name: Set facts
> ansible.builtin.set\_fact:
> container: "{{ master if item.type == 'master' else tserver }}"
> 
> \- name: Create container
> community.proxmox.proxmox:
> node: "{{ inventory\_hostname }}"
> vmid: "{{ container.vmid }}"
> description: "{{ container.description | default() }}"
> tags: "{{ container.tags | default({}) }}"
> ostemplate: "{{ template\_storage }}:{{ template\_type }}/{{ ostemplate }}"
> 
> hostname: "{{ container.hostname }}"
> cores: "{{ container.cores }}"
> swap: "{{ container.swap }}"
> memory: "{{ container.memory }}"
> disk: "{{ container.rootfs }}"
> netif: "{{ container\_netif | default({}) }}"
> 
> pubkey: "{{ lookup('file', ssh.pubkeys) | default() }}"
> password: "{{ container.password }}"
> 
> state: present
> force: true
> \`\`\`
> 
> 
> 
> \##### EXPECTED RESULTS
> It is expected to replace the container with a new one.
> 
> \##### ACTUAL RESULTS
> \`\`\`log
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> \< TASK \[Create container\] \>
> -------------------------
> \\ ^\_\_^
> \\ (oo)\\\_\_\_\_\_\_\_
> (\_\_)\\ )\\/\\
> ||----w |
> || ||
> 
> task path: /mnt/d/backup/Projects/MoxCluster/tools/src/deploy\_ct/deploy.yml:13
> File lookup using /mnt/d/backup/Projects/MoxCluster/components/lxc/yugabyte/certs/pubkeys.pub as file
> \<localhost\> ESTABLISH LOCAL CONNECTION FOR USER: miguel
> \<localhost\> EXEC /bin/sh -c 'echo ~miguel && sleep 0'
> \<localhost\> EXEC /bin/sh -c '( umask 77 && mkdir -p "\` echo /home/miguel/.ansible/tmp \`"&& mkdir "\` echo /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382 \`" && echo ansible-tmp-1756819428.6523044-20919-212550523484382="\` echo /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382 \`" ) && sleep 0'
> Using module file /home/miguel/.ansible/collections/ansible\_collections/community/proxmox/plugins/modules/proxmox.py
> \<localhost\> PUT /home/miguel/.ansible/tmp/ansible-local-204666u5es2uc/tmpc\_rm7nd8 TO /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382/AnsiballZ\_proxmox.py
> \<localhost\> EXEC /bin/sh -c 'chmod u+rwx /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382/ /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382/AnsiballZ\_proxmox.py && sleep 0'
> \<localhost\> EXEC /bin/sh -c 'PROXMOX\_HOST=192.168.1.201 PROXMOX\_USER=\[redacted\] PROXMOX\_TOKEN\_ID=\[redacted\] PROXMOX\_TOKEN\_SECRET=\[redacted\] /tmp/ansible-venv/bin/python3 /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382/AnsiballZ\_proxmox.py && sleep 0'
> \<localhost\> EXEC /bin/sh -c 'rm -f -r /home/miguel/.ansible/tmp/ansible-tmp-1756819428.6523044-20919-212550523484382/ \> /dev/null 2\>&1 && sleep 0'
> The full traceback is:
> File "/tmp/ansible\_community.proxmox.proxmox\_payload\_k4kb49hc/ansible\_community.proxmox.proxmox\_payload.zip/ansible\_collections/community/proxmox/plugins/modules/proxmox.py", line 1746, in main
> File "/tmp/ansible\_community.proxmox.proxmox\_payload\_k4kb49hc/ansible\_community.proxmox.proxmox\_payload.zip/ansible\_collections/community/proxmox/plugins/modules/proxmox.py", line 799, in run
> File "/tmp/ansible\_community.proxmox.proxmox\_payload\_k4kb49hc/ansible\_community.proxmox.proxmox\_payload.zip/ansible\_collections/community/proxmox/plugins/modules/proxmox.py", line 909, in lxc\_present
> File "/tmp/ansible\_community.proxmox.proxmox\_payload\_k4kb49hc/ansible\_community.proxmox.proxmox\_payload.zip/ansible\_collections/community/proxmox/plugins/modules/proxmox.py", line 1143, in new\_lxc\_instance
> File "/tmp/ansible\_community.proxmox.proxmox\_payload\_k4kb49hc/ansible\_community.proxmox.proxmox\_payload.zip/ansible\_collections/community/proxmox/plugins/modules/proxmox.py", line 1248, in create\_lxc\_instance
> File "/tmp/ansible-venv/lib/python3.11/site-packages/proxmoxer/core.py", line 179, in create
> return self.post(\*args, \*\*data)
> ^^^^^^^^^^^^^^^^^^^^^^^^
> File "/tmp/ansible-venv/lib/python3.11/site-packages/proxmoxer/core.py", line 170, in post
> return self(args).\_request("POST", data=data)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/tmp/ansible-venv/lib/python3.11/site-packages/proxmoxer/core.py", line 147, in \_request
> raise ResourceException(
> fatal: \[mox-node01 -\> localhost\]: FAILED! =\> {
> "changed": false,
> "invocation": {
> "module\_args": {
> "api\_host": ".....",
> "api\_password": null,
> "api\_port": null,
> "api\_token\_id": "....",
> "api\_token\_secret": "VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER",
> "api\_user": ".....",
> "clone": null,
> "clone\_type": "opportunistic",
> "cores": 4,
> "cpus": null,
> "cpuunits": null,
> "description": "Test Container",
> "disk": "local-lvm:8",
> "disk\_volume": null,
> "features": null,
> "force": true,
> "hookscript": null,
> "hostname": "test",
> "ip\_address": null,
> "memory": 4000,
> "mount\_volumes": null,
> "mounts": null,
> "nameserver": null,
> "netif": {},
> "node": "mox-node01",
> "onboot": null,
> "ostemplate": "mox-storage:vztmpl/pve-yugabyte\_2024.2.4.0.tar.gz",
> "ostype": "auto",
> "password": "VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER",
> "pool": null,
> "pubkey": "",
> "purge": false,
> "searchdomain": null,
> "startup": null,
> "state": "present",
> "storage": "local",
> "swap": 512,
> "tags": \[
> "yugabyte",
> "postgres",
> "cassandra",
> "intranet",
> "nodenet",
> "storage",
> "db",
> "ydb-master"
> \],
> "timeout": 30,
> "timezone": null,
> "unprivileged": true,
> "update": true,
> "validate\_certs": false,
> "vmid": 104
> }
> },
> "msg": "An error occurred: 500 Internal Server Error: CT 104 already exists on node 'mox-node01'"
> }
> \`\`\`

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 🙂

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [September 24, 2025, 1:27pm UTC](https://forum.ansible.com/t/community-proxmox-proxmox-force-option/44515/5 "2025-09-24T13:27:21Z")

</div>

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