首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ansible roles抛出错误@/root/roles:/root:/etc/ansible/roles

Ansible roles抛出错误@/root/roles:/root:/etc/ansible/roles
EN

Stack Overflow用户
提问于 2016-10-18 02:01:13
回答 1查看 1.8K关注 0票数 3

我是Ansible的新手,我已经创建了我的第一个Ansible角色剧本,当我试图运行它时,它抛出了下面的错误,而除了角色之外的其他模块(如处理程序、模板)工作得很好。我只在剧本中的角色中观察这个问题。

代码语言:javascript
复制
---
- hosts: webservers
  roles:
    - nginx
代码语言:javascript
复制
ERROR! 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

如果我遗漏了什么,请告诉我。

EN

回答 1

Stack Overflow用户

发布于 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中描述的方式使用它

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

https://stackoverflow.com/questions/40092826

复制
相关文章

相似问题

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