ansible LXC creation

simonli17

New Member
Mar 30, 2021
2
0
1
30
Heyo, playing with ansibles community.general.proxmox modul.
Trying to create simples LXC:
YAML:
---
- hosts: localhost

  tasks:
  - name: Create new LXC
    community.general.proxmox:
      node: "my node"
      api_user: "my user"
      api_token_id: "my id"
      api_token_secret: "my token"
      api_host: "my host"
      hostname: testtingansileproxmox
      ostemplate: 'local:vztmpl/centos-8-default_20191016_amd64.tar.xz'

...

I have created permission (Admin) for API token in "local" storage.
Running ansible gives me an error:
Code:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "creation of lxc VM 136 failed with exception: 403 Forbidden: Permission check failed - b'{\"data\":null}'"}

and -vvv output:
Code:
TASK [Create new LXC] *********************************************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/proxmox.yaml:5
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: "my user"
<127.0.0.1> EXEC /bin/sh -c 'echo ~"my user" && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/"my user"/.ansible/tmp `"&& mkdir "` echo /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358 `" && echo ansible-tmp-1617100668.456244-53624-145685935723358="` echo /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358 `" ) && sleep 0'
Using module file /home/"my user"/.ansible/collections/ansible_collections/community/general/plugins/modules/proxmox.py
<127.0.0.1> PUT /home/"my user"/.ansible/tmp/ansible-local-53555z2k8i8m3/tmpjnqap1_t TO /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358/AnsiballZ_proxmox.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358/ /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358/AnsiballZ_proxmox.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358/AnsiballZ_proxmox.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/"my user"/.ansible/tmp/ansible-tmp-1617100668.456244-53624-145685935723358/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_community.general.proxmox_payload_u3of59j3/ansible_community.general.proxmox_payload.zip/ansible_collections/community/general/plugins/modules/proxmox.py", line 613, in main
  File "/tmp/ansible_community.general.proxmox_payload_u3of59j3/ansible_community.general.proxmox_payload.zip/ansible_collections/community/general/plugins/modules/proxmox.py", line 424, in create_instance
  File "/home/********/.local/lib/python3.9/site-packages/proxmoxer/core.py", line 117, in create
    return self.post(*args, **data)
  File "/home/********/.local/lib/python3.9/site-packages/proxmoxer/core.py", line 108, in post
    return self(args)._request("POST", data=data)
  File "/home/********/.local/lib/python3.9/site-packages/proxmoxer/core.py", line 90, in _request
    raise ResourceException("{0} {1}: {2} - {3}".format(
[DEPRECATION WARNING]: The proxmox_default_behavior option will change its default value from "compatibility" to "no_defaults" in community.general 4.0.0. To remove this warning, please specify an explicit
value for it now. This feature will be removed from community.general in version 4.0.0. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "api_host": "my host",
            "api_password": null,
            "api_token_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_token_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_user": "my user",
            "cores": 1,
            "cpus": 1,
            "cpuunits": 1000,
            "description": null,
            "disk": "3",
            "features": null,
            "force": false,
            "hookscript": null,
            "hostname": "testtingansileproxmox",
            "ip_address": null,
            "memory": 512,
            "mounts": null,
            "nameserver": null,
            "netif": null,
            "node": "my node",
            "onboot": false,
            "ostemplate": "local:vztmpl/centos-8-default_20191016_amd64.tar.xz",
            "password": null,
            "pool": null,
            "proxmox_default_behavior": "compatibility",
            "pubkey": null,
            "purge": false,
            "searchdomain": null,
            "state": "present",
            "storage": "local",
            "swap": 0,
            "timeout": 30,
            "unprivileged": false,
            "validate_certs": false,
            "vmid": null
        }
    },
    "msg": "creation of lxc VM 136 failed with exception: 403 Forbidden: Permission check failed - b'{\"data\":null}'"
}