ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
820 stars 1.5k forks source link

proxmox_kvm: can't add cloud-init drive to a previusly created VM #7136

Open mabeett opened 1 year ago

mabeett commented 1 year ago

Summary

proxmox_kvm: when I try to add a cloud-init drive to a PVE created VM community.general.proxmox_kvm fails returning as msgunable to update vm None with vmid 176='ide2'.

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

$ ansible --version
ansible [core 2.15.3]
  config file = None
  configured module search path = ['/home/mabeett/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/mabeett/bin/venv/ansible-8.3.0/lib/python3.10/site-packages/ansible
  ansible collection location = /home/mabeett/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/mabeett/bin/venv/ansible-8.3.0/bin/ansible
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/home/mabeett/bin/venv/ansible-8.3.0/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /home/mabeett/bin/venv/ansible-8.3.0/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.3.0  

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

Ubuntu 22.04.3 LTS, Python 3.10.12 ansible installed via pip3 + venv

Steps to Reproduce

---
- hosts: all
  become: yes
  tasks:

  - name: Create new VM without cloud-init
    community.general.proxmox_kvm:
      api_user: "{{ proxmox_api_user }}"
      api_token_id: "{{ proxmox_token_id }}"
      api_token_secret: "{{ proxmox_token }}"
      api_host: "{{ proxmox_api_host }}"
      node: "{{ proxmox_node }}"
      name: foo
      ide:
        ide2: 'local:cloudinit,format=qcow2'
      net:
        net0: 'virtio,bridge=vmbr1,tag=77'
    register: foo_vm

  - name: updatethe previusly created VM
    community.general.proxmox_kvm:
      api_user: "{{ proxmox_api_user }}"
      api_token_id: "{{ proxmox_token_id }}"
      api_token_secret: "{{ proxmox_token }}"
      api_host: "{{ proxmox_api_host }}"
      node: "{{ proxmox_node }}"
      vmid: "{{ foo_vm.vmid }}"
      ide:
        ide2: 'local:cloudinit,format=qcow2'
      ciuser: mylinuxuser5
      cipassword: supersecret
      searchdomains: 'mydomain.internal'
      nameservers: 1.1.1.1
      ipconfig:
        ipconfig0: 'ip=192.168.1.1/24,gw=192.168.1.1'        
      update: true
      # proxmox_default_behavior: compatibility

  - name: Create new VM without cloud-init
    community.general.proxmox_kvm:
      api_user: "{{ proxmox_api_user }}"
      api_token_id: "{{ proxmox_token_id }}"
      api_token_secret: "{{ proxmox_token }}"
      api_host: "{{ proxmox_api_host }}"
      node: "{{ proxmox_node }}"
      name: bar
      net:
        net0: 'virtio,bridge=vmbr1,tag=77'
    register: bar_vm

  - name: Fail updating the previusly created VM
    community.general.proxmox_kvm:
      api_user: "{{ proxmox_api_user }}"
      api_token_id: "{{ proxmox_token_id }}"
      api_token_secret: "{{ proxmox_token }}"
      api_host: "{{ proxmox_api_host }}"
      node: "{{ proxmox_node }}"
      vmid: "{{ bar_vm.vmid }}"
      ide:
        ide2: 'local:cloudinit,format=qcow2'
      ciuser: mylinuxuser5
      cipassword: supersecret
      searchdomains: 'mydomain.internal'
      nameservers: 1.1.1.1
      ipconfig:
        ipconfig0: 'ip=192.168.1.1/24,gw=192.168.1.1'        
      update: true
      # proxmox_default_behavior: compatibility

Expected Results

Expected a new cloud-init drive with the referred attributes for the drive. The snipped is based on documentation. The taks fails with {"changed": false, "msg": "Unable to update vm None with vmid _ID_='ide2'", "vmid": _ID_}

Actual Results

TASK [Fail updating the previusly created VM] *******************************************************************************************************************************
task path: /home/mabeett/report_bug.yml:54
fatal: [some.host]: FAILED! => {"changed": false, "msg": "Unable to update vm None with vmid 176='ide2'", "vmid": 176}

PLAY RECAP ******************************************************************************************************************************************************************
some.host               : ok=4    changed=3    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description:

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 commented 1 year ago

cc @Ajpantuso @Thulium-Drake @UnderGreen @helldorado @joshainglis @karmab click here for bot help

ansibullbot commented 7 months ago

cc @krauthosting click here for bot help