stackhpc / stackhpc/openstack-config

HTTP 401 Unauthorized when uploading SSH key

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jinja
Stars
5
Forks
8
PR merge metrics
No merged PRs in 30d

Description

If you provide an SSH key to assign to user it will fail with HTTP 401 Unauthorized.

TASK [stackhpc.openstack.os_projects : Ensure SSH keypairs are registered] ***************************************************************************************************************************************************************************************************************************
Friday 22 August 2025  12:53:56 +0000 (0:00:00.091)       0:00:20.321 *********
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication. (HTTP 401) (Request-ID: req-430ec8e6-8f20-483c-a0c8-1a791189b211)
failed: [localhost] (item=demo: id_ed25519) => changed=false
  ansible_loop_var: item
  item:
  - description: OpenStack demo project
    name: demo
    project_domain: Default
    quotas:
      backup_gigabytes: -1
      backups: -1
      cores: -1
      floatingip: -1
      gigabytes: -1
      injected_file_size: -1
      injected_files: -1
      instances: -1
      key_pairs: -1
      per_volume_gigabytes: -1
      ram: -1
      security_group: -1
      security_group_rule: -1
      snapshots: -1
      volumes: -1
    user_domain: Default
    users:
    - description: StackHPC Demo user
      email: demo@stackhpc.com
      name: demo
      password: *****
      roles:
      - member
      - reader
  - name: id_ed25519
    public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICKx4TMa8vtpOe3qHeMX4Z7JZyucBcqlfv8iFY6dZkzB
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/stack/.ansible/tmp/ansible-tmp-1755867236.4199255-709459-103411628663297/AnsiballZ_keypair.py", line 107, in <module>
        _ansiballz_main()
      File "/home/stack/.ansible/tmp/ansible-tmp-1755867236.4199255-709459-103411628663297/AnsiballZ_keypair.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/stack/.ansible/tmp/ansible-tmp-1755867236.4199255-709459-103411628663297/AnsiballZ_keypair.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.openstack.cloud.plugins.modules.keypair', init_globals=dict(_module_fqn='ansible_collections.openstack.cloud.plugins.modules.keypair', _modlib_path=modlib_path),
      File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_openstack.cloud.keypair_payload_ve79l7iy/ansible_openstack.cloud.keypair_payload.zip/ansible_collections/openstack/cloud/plugins/modules/keypair.py", line 178, in <module>
      File "/tmp/ansible_openstack.cloud.keypair_payload_ve79l7iy/ansible_openstack.cloud.keypair_payload.zip/ansible_collections/openstack/cloud/plugins/modules/keypair.py", line 174, in main
      File "/tmp/ansible_openstack.cloud.keypair_payload_ve79l7iy/ansible_openstack.cloud.keypair_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/openstack.py", line 417, in __call__
      File "/tmp/ansible_openstack.cloud.keypair_payload_ve79l7iy/ansible_openstack.cloud.keypair_payload.zip/ansible_collections/openstack/cloud/plugins/modules/keypair.py", line 140, in run
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/openstack/service_description.py", line 89, in __get__
        proxy = self._make_proxy(instance)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/openstack/service_description.py", line 289, in _make_proxy
        found_version = temp_adapter.get_api_major_version()
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/adapter.py", line 352, in get_api_major_version
        return self.session.get_api_major_version(auth or self.auth, **kwargs)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/session.py", line 1289, in get_api_major_version
        return auth.get_api_major_version(self, **kwargs)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/identity/base.py", line 497, in get_api_major_version
        data = get_endpoint_data(discover_versions=discover_versions)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/identity/base.py", line 268, in get_endpoint_data
        service_catalog = self.get_access(session).service_catalog
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/identity/base.py", line 131, in get_access
        self.auth_ref = self.get_auth_ref(session)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/identity/generic/base.py", line 205, in get_auth_ref
        return self._plugin.get_auth_ref(session, **kwargs)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/identity/v3/base.py", line 185, in get_auth_ref
        resp = session.post(token_url, json=body, headers=headers,
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/session.py", line 1162, in post
        return self.request(url, 'POST', **kwargs)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/keystoneauth1/session.py", line 985, in request
        raise exceptions.from_response(resp, method, url)
    keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication. (HTTP 401) (Request-ID: req-430ec8e6-8f20-483c-a0c8-1a791189b211)
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the “Ensure SSH keypairs are registered” task and start with the ansible_collections.openstack.cloud keypair module shown in the traceback, especially keypair.py and module_utils/openstack.py. Trace the authentication configuration involved in the failed request; done means the task completes without HTTP 401 and the supplied SSH key is registered.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.