ansible - 无法使用循环复制文件
问题描述
我正在尝试使用 ansible 复制许多文件。这是我的剧本:
- name: Copy the scenario test
copy:
src: files/{{ scenario_name }}
dest: /home/{{ user }}/scenario_creation
mode: '0644'
run_once: true
loop: "{{ scenario_name }}"
tags:
- user
- scenario
这是我的角色/scenario_test/defaults/main.yml
scenario_name: ['topup-scenario.json', 'test.json']
当我执行我的剧本时,它说:
"msg": "Could not find or access 'files/[u'topup-scenario.json', u'test.json']'\nSearched in:\n\t/home/path/ansible/plays/files/[u'topup-scenario.json', u'test.json']\n\t/home/path/ansible/plays/files/[u'topup-scenario.json', u'test.json'] on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"
}
有什么帮助吗?
解决方案
改变:
src: files/
至
src: ./files/
推荐阅读
- python - 如何通过更改进度条的颜色来显示盾牌等级
- javascript - 在媒体查询中重新计算 div 有多麻烦
- asp.net - NuGet 退出并显示代码 -1073741502 - .Net 构建失败
- terraform - 如何从 terraform 模块调用自定义 terraform 提供程序
- git - 如何将 MLfLow 与私有 git 存储库一起使用?
- react-native - 向后滑动时可以看到抽屉
- animation - 这是什么类型的图表,我们如何创建它?这是我们可以在 Python 中做的事情吗?
- gremlin - 已经遍历的过滤器路径
- c++ - 如果两个线程调用同一个函数,但是函数中的所有变量都是局部变量,我还需要担心线程之间共享数据吗?
- java - Spring JPA Criteria Builder 特定列