1. Copying a Single File to the Target Server
[root@Jenkins copymodule]# cat copy.yml—– hosts: allremote_user: rootgather_facts: falsetasks:– name: “Copy file from host to target server”copy:src: “/root/ansible/luyan/copymodule/copytest1.txt”dest: “/opt/copymodule”owner: rootgroup: rootmode: 755
2. Copying Multiple Files to the Target Server
[root@Jenkins copymodule]# cat copyduogewenjian.yml—– hosts: allremote_user: rootgather_facts: falsetasks:– name: “Copy files from host to target server”copy:src: “{{ item.src }}”dest: “{{ item.dest }}”owner: rootgroup: rootmode: 755with_items:– {src:”/root/ansible/luyan/copymodule/copytest1.txt”, dest:”/opt/copymodule”}– {src:”/root/ansible/luyan/copymodule/copytest2.txt”, dest:”/opt/copymodule”}– {src:”/root/ansible/luyan/copymodule/copytest3.txt”, dest:”/opt/copymodule”}
———————-end———————
Recommended Reading
1.Practical – k8s Monitoring MySQL
2.Practical – Prometheus Monitoring Domain Certificate Expiration
3.Practical – Prometheus Monitoring MySQL
4.Practical – Prometheus Monitoring Redis
5.Nginx Implementing WAF Dynamic IP Blocking via Lua+Redis
6.Comprehensive Interpretation and Practical Exercises of Jenkins
7.eCommerce Project Kubernetes Deployment and Performance Optimization Practice
8.Essential Shell Scripts for Work (2)
9.Essential Shell Scripts for Work
10.Essential Shell Scripts for Work (3)
If this article has helped you, pleaselike, view, and share, it is very important for me to continue sharing and creating quality articles. Thank you 🙏🏻, if you need learning materials, please add WX:「DaDangJia-01」
Please like → light up “view” → share