Ansible Openstack 获取/更新应用程序凭证

Ansible Openstack 获取/更新应用程序凭证

我正在尝试通过 Ansible 获取和更新应用程序凭据openstack.cloud模块,但我找不到任何相关信息。是否可以使用 Ansible 列出我自己的应用程序凭据并创建一个新的?

我也尝试了openstack.cloud.resource,但是openstacksdk代理出现错误:

源代码:

- name: Test
  openstack.cloud.resource:
    cloud: openstack
    service: identity
    type: application_credential
    attributes:
      user: myuser
      name: app_cred_name
  register: app_cred_data

错误:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'Proxy' object has no attribute 'update_application_credential'. Did you mean: 'create_application_credential'?
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1695798933.7218165-40585-211051185410492/AnsiballZ_resource.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1695798933.7218165-40585-211051185410492/AnsiballZ_resource.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/vscode/.ansible/tmp/ansible-tmp-1695798933.7218165-40585-211051185410492/AnsiballZ_resource.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.openstack.cloud.plugins.modules.resource', init_globals=dict(_module_fqn='ansible_collections.openstack.cloud.plugins.modules.resource', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/modules/resource.py\", line 425, in <module>\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/modules/resource.py\", line 421, in main\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/openstack.py\", line 415, in __call__\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/modules/resource.py\", line 400, in run\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/resource.py\", line 43, in __init__\n  File \"/tmp/ansible_openstack.cloud.resource_payload_8dl_iu61/ansible_openstack.cloud.resource_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/resource.py\", line 19, in default_crud_functions\nAttributeError: 'Proxy' object has no attribute 'update_application_credential'. Did you mean: 'create_application_credential'?\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

答案1

我刚刚尝试过,我同意它不起作用。应用程序凭据是不可变的,因此没有更新方法。此外,get/find 方法有一个额外的用户参数,它不适用于该openstack.cloud.resource模型。我打算提出一个新的application_credential模块。

相关内容