Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxmox - setting state:template is not idempotent (for LXCs) #8811

Open
1 task done
fdcastel opened this issue Aug 27, 2024 · 3 comments
Open
1 task done

Proxmox - setting state:template is not idempotent (for LXCs) #8811

fdcastel opened this issue Aug 27, 2024 · 3 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@fdcastel
Copy link

Summary

Setting state:template on a LXC that is already a template fails with:

"msg": "conversion of VM 901 to template failed with exception: 500 Internal Server Error: you can't convert a template to a 
template"

This is exactly the same problem fixed in #7791, but now for LXCs (#7791 fixed it only for VMs).

Issue Type

Bug Report

Component Name

proxmox

Ansible Version

$ ansible --version

ansible [core 2.16.10]
  config file = /opt/araponga-ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.6.4

Configuration

$ ansible-config dump --only-changed
ANSIBLE_PIPELINING(/opt/araponga-ansible/ansible.cfg) = True
CONFIG_FILE() = /opt/araponga-ansible/ansible.cfg
DEFAULT_FORKS(/opt/araponga-ansible/ansible.cfg) = 12
DEFAULT_STRATEGY(/opt/araponga-ansible/ansible.cfg) = free

OS / Environment

Ubuntu 24.04 LTS
Promox VE 8.2.4

Steps to Reproduce

Expected Results

Skip (do not run) the task since it is already in the declared state.

Actual Results

fatal: [template-docker -> localhost({{inventory_hostname_short}}.{{domain_name}})]: FAILED! => {"changed": false, "msg": "conversion of VM 901 to template failed with exception: 500 Internal Server Error: you can't convert a template to a template", "vmid": 901}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

  • plugins/modules/proxmox

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Aug 27, 2024
@fdcastel fdcastel changed the title Proxmox - setting state:template is not idempotent Proxmox - setting state:template is not idempotent (for LXCs) Aug 27, 2024
@fdcastel
Copy link
Author

Workaround (for now)

        - name: Retrieve information about specific VM by ID
          community.general.proxmox_vm_info:
            vmid: "{{ lxc_id }}"
            type: lxc
          register: vm_info_result

        - name: "LXC container: convert to template"
          community.general.proxmox:
            vmid: "{{ lxc_id }}"
            state: template
            node: "{{ pve_host }}"
            api_host: "{{ proxmox.api_host }}"
            api_user: "{{ proxmox.api_user }}"
            api_password: "{{ proxmox.api_password }}"
          when: not vm_info_result.proxmox_vms[0].template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

2 participants