Skip to content

proxmox_storage does not authenticate #213

@LordSokaar

Description

@LordSokaar
SUMMARY

Creating proxmox_storage CIFS share doesn't works with authentication. The result is an 'NT_STATUS_LOGON_FAILURE'.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • proxmox_storage
ANSIBLE VERSION
ansible [core 2.19.3]
  config file = /mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg
  configured module search path = ['/home/florian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /mnt/d/repo_git/maison/ansible/playbooks/proxmox/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/florian/.ansible/collections:/usr/share/ansible/collections
  executable location = /mnt/d/repo_git/maison/ansible/playbooks/proxmox/.venv/bin/ansible
  python version = 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] (/mnt/d/repo_git/maison/ansible/playbooks/proxmox/.venv/bin/python)
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)
COLLECTION VERSION
Collection        Version
----------------- -------
community.proxmox 1.4.0
CONFIGURATION
CONFIG_FILE() = /mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg
DEFAULT_HOST_LIST(/mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg) = ['/mnt/d/repo_git/maison/ansible/playbooks/proxmox/inventory.yml']
DEFAULT_ROLES_PATH(/mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg) = ['/mnt/d/repo_git/maison/ansible/playbooks/proxmox/roles']
HOST_KEY_CHECKING(/mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg) = False
INTERPRETER_PYTHON(/mnt/d/repo_git/maison/ansible/playbooks/proxmox/ansible.cfg) = auto_silent
OS / ENVIRONMENT

Ubuntu WSL

STEPS TO REPRODUCE

Create storage on remote shared folder with the module

Task :

- name: Add CIFS storage bootable-images
  community.proxmox.proxmox_storage:
    api_host: "{{ proxmox_api_host }}"
    api_port: "{{ proxmox_api_port }}"
    validate_certs: "{{ proxmox_api_validate_certs }}"
    api_user: "{{ proxmox_api_admin_user }}"
    api_token_id: "{{ proxmox_api_admin_token_id }}"
    api_token_secret: "{{ proxmox_api_admin_token_secret }}"

    nodes: "{{ proxmox_storage_target_nodes }}"
    state: "{{ cifs_storage_state }}"
    name: "{{ item.name }}"
    type: "{{ cifs_storage_type }}"
    cifs_options:
      username: "{{ item.username | default(proxmox_cifs_storage_username) }}"
      password: "{{ item.password | default(proxmox_cifs_storage_password) }}"
      server: "{{ item.server}}"
      share: "{{ item.share }}"
      smb_version: "{{ item.smb_version }}"

    content: "{{ item.content | join(',') }}"
  loop: "{{ proxmox_storage_cifs }}"
  loop_control:
    label: "{{ item.name }}"

Variables :

proxmox_storage_cifs:
 - name: "bootable-images"
   server: "192.168.1.123"
   share: "proxmox"
   smb_version: "2.0"
   username: "myuser"
   password: "mypassword"
   content: ["images"]
EXPECTED RESULTS

Storage shared created like

TASK [proxmox_storage : Add CIFS storage bootable-images] ************************************************************************************************************************************
changed: [localhost] => (item=bootable-images)
ACTUAL RESULTS

NO_STATUS_LOGON_FAILURE raises.

TASK [proxmox_storage : Add CIFS storage bootable-images] ************************************************************************************************************************************
task path: /mnt/d/repo_git/maison/ansible/playbooks/proxmox/roles/proxmox_storage/tasks/main.yml:4
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: florian
<localhost> EXEC /bin/sh -c 'echo ~florian && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/florian/.ansible/tmp `"&& mkdir "` echo /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297 `" && echo ansible-tmp-1762166680.3650692-16926-36179051125297="` echo /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297 `" ) && sleep 0'
<localhost> Attempting python interpreter discovery.
<localhost> EXEC /bin/sh -c 'echo FOUND; command -v '"'"'python3.13'"'"'; command -v '"'"'python3.12'"'"'; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python3'"'"'; echo ENDFOUND && sleep 0'
Using module file /home/florian/.ansible/collections/ansible_collections/community/proxmox/plugins/modules/proxmox_storage.py
<localhost> PUT /home/florian/.ansible/tmp/ansible-local-16904a6lnli67/tmp4uulq5z3 TO /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297/AnsiballZ_proxmox_storage.py
<localhost> EXEC /bin/sh -c 'chmod u+rwx /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297/ /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297/AnsiballZ_proxmox_storage.py && sleep 0'
<localhost> EXEC /bin/sh -c '/mnt/d/repo_git/maison/ansible/playbooks/proxmox/.venv/bin/python3.12 /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297/AnsiballZ_proxmox_storage.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/florian/.ansible/tmp/ansible-tmp-1762166680.3650692-16926-36179051125297/ > /dev/null 2>&1 && sleep 0'
[ERROR]: Task failed: Module failed: Failed to create storage: 500 Internal Server Error: create storage failed: connection check for storage 'bootable-images' failed - session setup failed: NT_STATUS_LOGON_FAILURE
Origin: /mnt/d/repo_git/maison/ansible/playbooks/proxmox/roles/proxmox_storage/tasks/main.yml:4:3

2 # bootable-images /mnt/pve/bootable-images Disk image
3 # pvesm add cifs bootable-images --server 192.168.1.123 --share proxmox --subdir /bootable-images --username proxmox...
4 - name: Add CIFS storage bootable-images
    ^ column 3

failed: [localhost] (item=bootable-images) => {
    "ansible_facts": {
        "discovered_interpreter_python": "/mnt/d/repo_git/maison/ansible/playbooks/proxmox/.venv/bin/python3.12"
    },
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "api_host": "192.168.1.206",
            "api_password": null,
            "api_port": 8006,
            "api_token_id": "florian",
            "api_token_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_user": "florian@pve",
            "cephfs_options": null,
            "cifs_options": {
                "domain": null,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "server": "192.168.1.123",
                "share": "proxmox",
                "smb_version": "2.0",
                "username": "proxmox"
            },
            "content": [
                "images"
            ],
            "dir_options": null,
            "iscsi_options": null,
            "name": "bootable-images",
            "nfs_options": null,
            "nodes": [
                "proxmox4"
            ],
            "pbs_options": null,
            "state": "present",
            "type": "cifs",
            "validate_certs": false,
            "zfspool_options": null
        }
    },
    "item": {
        "content": [
            "images"
        ],
        "name": "bootable-images",
        "server": "192.168.1.123",
        "share": "proxmox",
        "smb_version": "2.0"
    },
    "msg": "Failed to create storage: 500 Internal Server Error: create storage failed: connection check for storage 'bootable-images' failed - session setup failed: NT_STATUS_LOGON_FAILURE"
}

PLAY RECAP ***********************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

I tried through a Burp proxy to retrieve the API call, i got :

POST /api2/json/storage HTTP/1.1
Host: 192.168.1.206:8006
User-Agent: python-requests/2.32.5
Accept-Encoding: gzip, deflate, br
accept: application/json, application/x-javascript, text/javascript, text/x-javascript, text/x-json
Connection: keep-alive
Content-Length: 97
Content-Type: application/x-www-form-urlencoded
Authorization: PVEAPIToken=florian@pve!florian=d4396054-e4ad-440a-aa24-5d76a339d0ed

storage=bootable-images&type=cifs&nodes=proxmox4&content=images&server=192.168.1.123&share=proxmox

CIFS options are not transfered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions