0
TASK [Test: Install Test Authentication] ***********************************
fatal: [ubuntu2004]: FAILED! => {"reason": "Could not find or access '/home/test/test.playbook/molecule/default/test.yaml' on the Ansible Controller."}

Molecule 相对于 .roles 文件夹可以很好地处理文件和模板...为什么在通过以下方式调用任务时不会发生这种情况include_tasks

- name: Install Test Authentication
  include_tasks:
    file: test.yaml
  when: test is defined

文件夹结构非常简单。

~/playbook
  |___molecule
        |___default
              |___converge.yaml
  |___.roles
        |___ files
        |___ tasks
              |___ main.yaml <- called with no issues
              |___ test.yaml <- will not find when used in case above.

显然,还有其他文件......但我的模板任务和文件任务工作正常......遵循它们的相对路径但任务不会,为什么会这样或者我做错了什么。我找不到任何文档,我确信其他人也遇到了这个问题,但我能找到的只有以下内容:

https://github.com/ansible-community/molecule/issues/2171这是关于 ansible-lint 但它是我能找到的最接近的东西。

此外,似乎总共有 4 个地点可以讨论/询问有关分子的问题……所以我不确定哪个会首先得到回答。

|TLDR; 如何让分子正确遵循 include_tasks。

4

1 回答 1

0

从我看到你有一个错误的角色结构。

分子文件夹应该在角色文件夹中。

分子作用的示例结构

这是从你应该开始的。之后重新检查文件命名。最近我有一个常见的问题,它是因为缺少文件扩展名。

于 2021-03-15T20:47:52.607 回答