我有一个具有从git的作用结账代码(以下两个拷贝)一个test.yml文件:ansible角色无法找到模块
site.yml
---
- hosts: webservers
user: me
roles:
- role: test-role
为主。在测试角色YML文件/任务
---
- name: fetching my repo
vars:
my_repo_url: [email protected]:myrepo/my-server.git
my_proj_path: /tmp/repos/my-server/
tasks:
- name: check out git repository on host
git: repo={{ my_repo_url }} dest={{ my_proj_path }} accept_hostkey=yes
主机:
[webservers]
testserver ansible_ssh_host=xxx.xxx.xxx.xxxx ansible_ssh_port=xxxx
当我运行以下
:
ansible-playbook -i hosts site.yml
我得到复制下面引用了角色的任务部分的main.yml文件除外。任何想法我可能错误配置。
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/home/user/git/roles/test-role/tasks/main.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: fetching my repo
^here
The error appears to have been in '/home/user/git/test/roles/test-role/tasks/main.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: fetching my repo
^here
更新 试图改变按康斯坦丁的反馈,但我得到或多或少相同的异常:
角色/测试角色/默认/ main.yml
---
vars:
my_repo_url: [email protected]:myrepo/my-server.git
my_proj_path: /tmp/repos/my-server/
tasks/main.yml
---
- name: fetching my repo
tasks:
- name: check out git repository on host
git: repo={{ my_repo_url }} dest={{ my_proj_path }} accept_hostkey=yes
例外: 现在它抱怨下面的行。当我运行语法检查时,我得到相同的响应。
---
- name: fetching my repo
^here
更新 其次康斯坦丁和Avalon的答案 - 我能成功运行任务。
spaciba - 更新我的原始文章与您的建议,但它不工作 - 任何想法 - 在此先感谢 –
我的代码是不同的,请密切关注,请。 –
spaciba - 两个答案同样有用 –