首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >分子错误:计算的完全限定的角色名称不符合当前的galaxy要求

分子错误:计算的完全限定的角色名称不符合当前的galaxy要求
EN

Stack Overflow用户
提问于 2021-10-20 20:09:52
回答 2查看 520关注 0票数 1

我对ansible和ansible角色完全陌生。我已经创建了我的第一个角色,并想用分子来测试它。

如果我运行molecule test,我得到一个错误:Computed fully qualified role name of generate_random_password does not follow current galaxy requirements. Please edit meta/main.yml and assure we can correctly determine full role name:

完整输出:

代码语言:javascript
复制
INFO     default scenario test matrix: dependency, lint, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO     Performing prerun...
INFO     Added ANSIBLE_LIBRARY=/home/tom/.cache/ansible-compat/62faec/modules:/home/tom/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Added ANSIBLE_COLLECTIONS_PATH=/home/tom/.cache/ansible-compat/62faec/collections:/home/tom/.ansible/collections:/usr/share/ansible/collections
INFO     Added ANSIBLE_ROLES_PATH=/home/tom/.cache/ansible-compat/62faec/roles:/home/tom/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
ERROR    Computed fully qualified role name of generate_random_password does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:

galaxy_info:
role_name: my_name  # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace  # if absent, author is used instead

Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names

As an alternative, you can add 'role-name' to either skip_list or warn_list.

Traceback (most recent call last):
  File "/home/tom/.local/bin/molecule", line 8, in <module>
    sys.exit(main())
  File "/home/tom/.local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/tom/.local/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/tom/.local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/tom/.local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tom/.local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/tom/.local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/tom/.local/lib/python3.9/site-packages/molecule/command/test.py", line 159, in test
    base.execute_cmdline_scenarios(scenario_name, args, command_args, ansible_args)
  File "/home/tom/.local/lib/python3.9/site-packages/molecule/command/base.py", line 111, in execute_cmdline_scenarios
    scenario.config.runtime.prepare_environment()
  File "/home/tom/.local/lib/python3.9/site-packages/ansible_compat/runtime.py", line 255, in prepare_environment
    self._install_galaxy_role(self.project_dir, ignore_errors=True)
  File "/home/tom/.local/lib/python3.9/site-packages/ansible_compat/runtime.py", line 396, in _install_galaxy_role
    raise InvalidPrerequisiteError(msg)
ansible_compat.errors.InvalidPrerequisiteError: Computed fully qualified role name of generate_random_password does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:

galaxy_info:
role_name: my_name  # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace  # if absent, author is used instead

Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names

As an alternative, you can add 'role-name' to either skip_list or warn_list.

如果我没记错,角色名generate_random_password是一个有效的角色名。我做错了什么?

EN

回答 2

Stack Overflow用户

发布于 2021-11-01 20:20:48

我自己遇到了这个问题,发现我需要一个名称空间:在我的meta/main.yml中。添加这些代码行对我来说很管用。

代码语言:javascript
复制
galaxy_info:
  role_name: linux_administration
  namespace: glennbell
票数 1
EN

Stack Overflow用户

发布于 2021-10-23 19:25:39

将以下属性添加到meta/main.yml

代码语言:javascript
复制
role_name: generate_random_password
galaxy_name: tbuyvoets

显然,当您运行molecule init role <rolename>时,默认情况下meta/main.yml文件中没有包含这一点。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69652451

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档