Using Ansible Playbook to Copy Multiple Files to Target Server
Using with_items to Copy Multiple Files/Directories If you want to copy multiple files, you can use with_items to iterate over them. — – hosts: all remote_user: root gather_facts: false tasks: – name : copy file copy: src: /root/{{item}} dest: /usr/local/apps/ with_items: [’45.txt’, ‘run.sh’,’node_exporter.tar.gz’] [root@ansible ~]# ansible-playbook -C copy.yaml [root@ansible ~]# ansible-playbook copy.yaml Check the copied … Read more