community.general icon indicating copy to clipboard operation
community.general copied to clipboard

Creating Proxmox VMs Fails Agent Wrong Format

Open fritterhoff opened this issue 1 year ago • 2 comments

Summary

Creating new proxmox vms fails due to wrong ansible agent format.

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

❯ ansible --version
ansible [core 2.13.5]
  config file = /Users/florian/sources/server-deployment/ansible.cfg
  configured module search path = ['/Users/florian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/florian/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

❯ ansible-galaxy collection list community.general

# /Users/florian/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 5.7.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

- name: Test
  hosts: 
    - proxmox-hw08
  tasks:
    - name: Create VM
      proxmox_kvm: 
        name: test
        node: proxmox-hw08
        api_host: "{{ pm_api_url }}"
        proxmox_default_behavior: no_defaults
        api_user: "{{ pm_user }}"
        api_token_id: "{{ pm_token_id }}"
        api_token_secret: "{{ pm_token_secret }}"
        agent: true

Expected Results

VM gets created

Actual Results

The full traceback is:
  File "/tmp/ansible_proxmox_kvm_payload_t6g0fl_7/ansible_proxmox_kvm_payload.zip/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox_kvm.py", line 1252, in main
  File "/tmp/ansible_proxmox_kvm_payload_t6g0fl_7/ansible_proxmox_kvm_payload.zip/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox_kvm.py", line 1018, in create_vm
  File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 155, in create
    return self.post(*args, **data)
  File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 146, in post
    return self(args)._request("POST", data=data)
  File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 123, in _request
    raise ResourceException(
fatal: [proxmox-hw08]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "acpi": null,
            "agent": "1",
            "api_host": "<REDACTED>",
            "api_password": null,
            "api_token_id": "Ansible",
            "api_token_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_user": "<REDACTED>",
            "args": null,
            "autostart": null,
            "balloon": null,
            "bios": null,
            "boot": null,
            "bootdisk": null,
            "cicustom": null,
            "cipassword": null,
            "citype": null,
            "ciuser": null,
            "clone": null,
            "cores": null,
            "cpu": null,
            "cpulimit": null,
            "cpuunits": null,
            "delete": null,
            "description": null,
            "digest": null,
            "efidisk0": null,
            "force": null,
            "format": null,
            "freeze": null,
            "full": true,
            "hostpci": null,
            "hotplug": null,
            "hugepages": null,
            "ide": null,
            "ipconfig": null,
            "keyboard": null,
            "kvm": null,
            "localtime": null,
            "lock": null,
            "machine": null,
            "memory": null,
            "migrate_downtime": null,
            "migrate_speed": null,
            "name": "test",
            "net": null,
            "newid": null,
            "node": "proxmox-hw08",
            "numa": null,
            "numa_enabled": null,
            "onboot": null,
            "ostype": null,
            "parallel": null,
            "pool": null,
            "protection": null,
            "proxmox_default_behavior": "no_defaults",
            "reboot": null,
            "revert": null,
            "sata": null,
            "scsi": null,
            "scsihw": null,
            "serial": null,
            "shares": null,
            "skiplock": null,
            "smbios": null,
            "snapname": null,
            "sockets": null,
            "sshkeys": null,
            "startdate": null,
            "startup": null,
            "state": "present",
            "storage": null,
            "tablet": null,
            "tags": null,
            "target": null,
            "tdf": null,
            "template": null,
            "timeout": 30,
            "update": false,
            "validate_certs": false,
            "vcpus": null,
            "vga": null,
            "virtio": null,
            "vmid": null,
            "watchdog": null
        }
    },
    "msg": "creation of qemu VM test with vmid 197 failed with exception=400 Bad Request: Parameter verification failed. - {'agent': \"invalid format - format error\\nagent.enabled: type check ('boolean') failed - got 'True'\\n\"}",
    "vmid": "197"
}

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

fritterhoff avatar Oct 14 '22 11:10 fritterhoff

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 avatar Oct 14 '22 11:10 ansibullbot

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

ansibullbot avatar Oct 14 '22 11:10 ansibullbot

Ran into this as well. git blame spits out this commit: https://github.com/ansible-collections/community.general/commit/0be7b6e7b91bb2d7b6e16773cc9b93a655ca0dd6 I checked and it works as as expected when reverting the change,

spike77453 avatar Oct 16 '22 03:10 spike77453

See also #5198.

felixfontein avatar Oct 16 '22 06:10 felixfontein

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 avatar Nov 09 '22 07:11 ansibullbot