Proxmox inventory no such user error

My goal is to be able to generate my inventory based on the VMs available on proxmox. I am trying to use an api token. I get no such user error.

I thought it was because I’m using a pam user since the docs show using a pve user but that doesn’t seem to be it.

I find it a bit odd that it says its using /api2/json/nodes. When I open that url on my proxmox server it just shows a list of the nodes. Nothing to do with users but maybe it isn’t trying to get them from there per se. But why wouldn’t it show “/api2/json/access/users” instead since that shows a list of users?

ansible [core 2.18.0]
proxmox 8.2.2
Arch Linux latest

some potentially important facts:

  1. proxmox is behind an nginx reverse proxy
  2. I also have openid registered users on proxmox

command I am running:

ansible-inventory -i config.proxmox.yaml --graph -vvvv

config.proxmox.yaml:

plugin: community.general.proxmox
url: https://proxmox.company.com
user: ansiblepve@pve
token_id: ansiblepve@pve!ansibleworking
token_secret: e2a77674-388d-43f4-83d5-9a724dc73d90
validate_certs: true

output:

ansible-inventory [core 2.18.0]
  config file = /home/username/Documents/src/ansible_automations/run_server_updates/ansible.cfg
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/username/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-inventory
  python version = 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True
Using /home/username/Documents/src/ansible_automations/run_server_updates/ansible.cfg as config file
setting up inventory plugins
Loading collection community.general from /usr/share/ansible/collections/ansible_collections/community/general
Loading collection ansible.builtin from
host_list declined parsing /home/username/Documents/src/ansible_automations/run_server_updates/config.proxmox.yaml as it did not pass its verify_file() method
script declined parsing /home/username/Documents/src/ansible_automations/run_server_updates/config.proxmox.yaml as it did not pass its verify_file() method
toml declined parsing /home/username/Documents/src/ansible_automations/run_server_updates/config.proxmox.yaml as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /home/username/Documents/src/company/ansible_automations/run_server_updates/config.proxmox.yaml with
ansible_collections.community.general.plugins.inventory.proxmox plugin: 401 Client Error: no such user
('ansiblepve@pve!ansiblepve@pve') for url: https://proxmox.company.com/api2/json/nodes
  File "/usr/lib/python3.12/site-packages/ansible/inventory/manager.py", line 292, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/share/ansible/collections/ansible_collections/community/general/plugins/inventory/proxmox.py", line 685, in parse
    self._populate()
  File "/usr/share/ansible/collections/ansible_collections/community/general/plugins/inventory/proxmox.py", line 613, in _populate
    for node in self._get_nodes():
                ^^^^^^^^^^^^^^^^^
  File "/usr/share/ansible/collections/ansible_collections/community/general/plugins/inventory/proxmox.py", line 341, in _get_nodes
    return self._get_json("%s/api2/json/nodes" % self.proxmox_url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/ansible/collections/ansible_collections/community/general/plugins/inventory/proxmox.py", line 317, in _get_json
    ret.raise_for_status()
  File "/usr/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
[WARNING]:  * Failed to parse /home/username/Documents/src/company/ansible_automations/run_server_updates/config.proxmox.yaml with yaml plugin: Plugin configuration YAML file,
not YAML inventory
  File "/usr/lib/python3.12/site-packages/ansible/inventory/manager.py", line 292, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3.12/site-packages/ansible/plugins/inventory/yaml.py", line 113, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse /home/username/Documents/src/company/ansible_automations/run_server_updates/config.proxmox.yaml with ini plugin: Invalid host pattern 'plugin:'
supplied, ending in ':' is not allowed, this character is reserved to provide a port.
  File "/usr/lib/python3.12/site-packages/ansible/inventory/manager.py", line 292, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3.12/site-packages/ansible/plugins/inventory/ini.py", line 137, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /home/username/Documents/src/company/ansible_automations/run_server_updates/config.proxmox.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

hello, are you sure about the value of token_id ?
In Proxmox, if you go in Data Center => Permissions => Api token, the value of the column ‘token name’ is actually ‘ansiblepve@pve!ansibleworking’ ?
Also, in my plugin file, I specify the port 8006 in the URL.

Yes it looks like it was the token. I’m not sure why but that was what the setup dialog was outputting for the token in the proxmox gui. It only changes to the correct one when I view it after the fact. Thanks for pointing that out.