【发布时间】:2016-10-17 18:01:13
【问题描述】:
我是 Ansible 的新手,我已经创建了我的第一个 Ansible 角色剧本,当我尝试运行它时,它会抛出下面的错误,而除了角色之外的其他模块(如处理程序、模板)工作正常。我仅在剧本中的角色中观察到这个问题。
---
- hosts: webservers
roles:
- nginx
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
如果我在这里遗漏了什么,请告诉我。
【问题讨论】:
-
你的角色所在的
nginx目录在哪里? -
它位于 /etc/ansible/roles/ngnix
-
ls -l /etc/ansible/roles/nginx/tasks/main.yml的结果是什么? -
您好,/etc/ansible/roles/nginx/ 下没有创建任何内容。 root@ubuntu-96:/etc/ansible/roles/ngnix# ls -l total 0
标签: ansible