ฉันใช้สิ่งนี้: 1. ดึงไดเรกทอรีจากโฮสต์ระยะไกลไปยังโฮสต์ที่เฉพาะเจาะจง
- name: Gather hosts stats from other hosts
shell: " scp -r {{results_root_dir_src}} root@{{groups['profiling_server'][0]}}:{{results_root_dir_dest}}/abc/"
when: "'profiling_server' not in group_names"
#It will not run on the node where the directories need to be copied.
- ดึงไดเร็กทอรีจากโหนดไปยัง localhost
- name: Gather from host to local
delegate_to: 127.0.0.1
run_once: true
become: false
shell: "scp -r root@{{groups['profiling_server'][0]}}:{{results_root_dir}} ./results_local_location "
สินค้าคงคลัง
[nodes]
server1
server2
server3
[profiling_server]
server1