我有两个攻略,需要一个运行在另一个。第一个文件准备env (例如,将其他剧本带到本地主机),第二个文件使用准备文件和角色。
---
- name: PREP
import_playbook: prep.yml
- name: after
import_playbook: after.yml我得到一个编译错误:
罗尔!在....中找不到角色'from_prep_role‘。该错误似乎位于'/root/dev/ansible-roles/after.yml':第13行,第9列,但可能位于文件中的其他位置,具体取决于确切的语法问题。
令人不快的行看起来是:
- { role: from_prep_role}
^ here我该怎么解决它呢?第一个剧本带来了第二个剧本使用的所有角色。谢谢
发布于 2021-05-27 22:17:16
似乎缺少“角色”路径配置,至少缺少"from_prep_role“角色的路径。检查应用的"ansible.cfg“文件中的"roles_path”属性,应该如下所示:
roles_path = ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/another/path/to/your/roles:/another/second/path/to/your/other/roles请注意,有许多Ansible配置。文件可能会导致不必要的行为(Asnible选择第一个找到的文件,忽略其余的),有关详细信息,请参阅https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file。
https://stackoverflow.com/questions/67716786
复制相似问题