Sty*_*leZ 5 ansible ansible-template
当我尝试从本地目录复制到远程目录时,我的项目出现错误
错误信息:
fatal: [xxx]: FAILED! => {
"changed": false, "msg": "could not find
src=/Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates,
Could not find or access
'/Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates'
on the Ansible Controller.\n
If you are using a module and expect the file to exist on the remote, see the remote_src option"
}
Run Code Online (Sandbox Code Playgroud)
剧本.yml
- name: Copying required files
template:
src: ./roles/docker_registry/templates
dest: /tmp/docker_registry
Run Code Online (Sandbox Code Playgroud)
如果我做:
cd /Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates
Run Code Online (Sandbox Code Playgroud)
它将目录更改为我想要的目录...错误似乎来自ansible端。(它不适用于绝对路径八)
如果我使用默认的复制模块,那么它工作得很好
- name: copy files [local -> remote]
copy:
src: ./roles/docker_registry/templates
dest: /tmp/docker_registry
Run Code Online (Sandbox Code Playgroud)
知道我应该做什么才能让它发挥作用吗?[其从本地复制 -> 远程 ]
仅适用于“文件”的解决方案
好吧,我要保留这个,以防万一有人会遇到和我一样的问题...我搞砸的是正在src:调查角色templates文件...错误告诉我它正在访问full path哪个不是真的...它只访问一个templates文件,然后从那里继续...
固定代码:
- name: Copying required files
template:
src: docker-compose.yml
dest: /tmp/docker_registry
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
49161 次 |
| 最近记录: |