클라우드/Ansible
Ansible 원격지 파일 가져오기 (fetch 모듈)
이쿠우우
2022. 1. 27. 15:48
반응형
파일 가져오기 (fetch 모듈)
managed node에서 control node로 파일 가져오기
fetch 모듈 사용.
playbook 예제
---
- hosts: all
remote_user: root
become: true
tasks:
- name: file move to control node
fetch:
src: /temp/sample.txt
dest: ./managedNodeFile.txt
flat: yes
|
"src:"
복사할 파일 경로
managed node 경로
"dest:"
붙여넣기할 파일 경로
control node 경로
"flat: yes"
flat yes 설정을 하지 않으면 dest 경로에 src 경로전체가 복사됨.
playbook 실행
ansible-playbook -i host.ini ./testplaybook
Managed node에서 결과 확인
control node에서 가져온 파일 확인.
참고
반응형