我有一個具有從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 - 兩個答案同樣有用 –