使用 Ansible 复制多个文件 [英] Copy multiple files with Ansible
本文介绍了使用 Ansible 复制多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在任务中通过 Ansible 将多个文件复制到远程节点?
How can I copy more than a single file into remote nodes by Ansible in a task?
我试图在我的任务中复制复制模块行来定义文件,但它只复制了第一个文件.
I've tried to duplicate the copy module line in my task to define files but it only copies the first file.
推荐答案
您可以为此使用 with_fileglob
循环:
You can use the with_fileglob
loop for this:
- copy:
src: "{{ item }}"
dest: /etc/fooapp/
owner: root
mode: 600
with_fileglob:
- /playbooks/files/fooapp/*
这篇关于使用 Ansible 复制多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文