我是Ansible的新手,我已经创建了我的第一个Ansible角色剧本,当我试图运行它时,它抛出了下面的错误,而除了角色之外的其他模块(如处理程序、模板)工作得很好。我只在剧本中的角色中观察这个问题。
---
- hosts: webservers
roles:
- nginxERROR! the role 'nginx' was not found in /root/roles:/root:/etc/ansible/roles
The error appears to have been in '/root/server.yml': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- nginx
^ here在ansible.cng文件中,我将路径指定为roles_path = /etc/ansible/roles
如果我遗漏了什么,请告诉我。
发布于 2016-10-18 13:39:26
因为Ansible在文件夹/root/roles、/root、/etc/ansible/roles或local./roles中找不到nginx角色。
如果你想使用一个名为nginx的角色,ansible会尝试在你的角色文件夹中加载一个nginx/task/main.yml文件。
将以下代码复制到您的nginx角色文件夹:https://github.com/jdauphant/ansible-role-nginx
并按照其README.md中描述的方式使用它
https://stackoverflow.com/questions/40092826
复制相似问题