如何在 Openstack Ansible 模块中使用身份验证令牌

问题描述 投票:0回答:1

我正在为包含使用 Ansible 的 openstack.cloud 集合的任务的 playbook 运行 ansible-playbook 命令,尝试使用从上一个任务返回的身份验证令牌:

- name: "Use Token for Retrieving SGs"
  openstack.cloud.security_group_info:
    auth: "{{api_token_response}}"
    auth_type: openstack.cloud.auth
    name: default
  register: security_group_results

返回的错误如下,我确信我误解了这个身份验证插件。我可能输入了错误的“auth_type”吗?

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin: The plugin openstack.cloud.auth could not be found
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):
  File \"/usr/local/lib/python3.10/dist-packages/keystoneauth1/loading/base.py\", line 78, in get_plugin_loader
    mgr = stevedore.DriverManager(namespace=PLUGIN_NAMESPACE,
  File \"/usr/local/lib/python3.10/dist-packages/stevedore/driver.py\", line 54, in __init__
    super(DriverManager, self).__init__(
  File \"/usr/local/lib/python3.10/dist-packages/stevedore/named.py\", line 89, in __init__
    self._init_plugins(extensions)
  File \"/usr/local/lib/python3.10/dist-packages/stevedore/driver.py\", line 113, in _init_plugins
    raise NoMatches('No %r driver found, looking for %r' %
stevedore.exception.NoMatches: No 'keystoneauth1.plugin' driver found, looking for 'openstack.cloud.auth'

During handling of the above exception, another exception occurred:
....
....
....
keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin: The plugin openstack.cloud.auth could not be found

我的 api_token_response 变量是一个如下所示的字典:

{
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "auth_token": "asdf1234workssuccessfully",
    "changed": false,
    "failed": false
}
ansible openstack
1个回答
0
投票

您将整个

apo_token_response
变量作为身份验证令牌传递。您很可能想从中传递一个特定值,如下所示:

- name: "Use Token for Retrieving SGs"
  openstack.cloud.security_group_info:
    auth: "{{ api_token_response.auth_token }}"
    auth_type: openstack.cloud.auth
    name: default
  register: security_group_results
© www.soinside.com 2019 - 2024. All rights reserved.