我正在使用ansible的git模块(使用2.1)来提取一个repo,然后使用shell模块更改为下载的repo(如果shell不起作用,我可以尝试该命令)。我有两个include.yml文件(一个从git中抽取,另一个使用shell命令) - 角色的任务目录中都有一个角色。 git clone可以正常工作,但即使是shell命令也没有(它似乎无法检测到该目录已创建 - 即使我可以使用另一个shell转到该目录)。我尝试使用wait_for(但它永远不会返回)。我使用我的本地用户ID完成所有任务,并使用我的ID创建了git仓库。wait_for with ansible not working
shell.yml
---
- wait_for: path=/tmp/my-repos/my-proj
- shell: cd /tmp/my-repos/my-proj
main.yml
---
- include: git.yml
- include: shell.yml
git.yml
---
- name: fetching my repo
local_action: git repo={{ my_repo_url }}
dest={{ my_proj_path }}
accept_hostkey=yes
depth=10
version={{ my_project_version }}
问题在shell命令之前没有使用local_action - 命令在远程计算机上运行,而不是在控制器计算机上运行 –