유능한 작동 방식 (호스트 패턴, 전략, 처리기 ...)에 대한 설명서를주의 깊게 읽어야합니다.
이
---
# Push mode (connect to xenial1 and rsync-push to other hosts)
- hosts: xenial-group:!xenial1
gather_facts: no
tasks:
- synchronize:
src: /tmp/hello.txt
dest: /tmp/hello.txt
delegate_to: xenial1
# Pull mode (connect to other hosts and rsync-pull from xenial1)
- hosts: xenial1
gather_facts: no
tasks:
- synchronize:
src: /tmp/hello.txt
dest: /tmp/hello.txt
mode: pull
delegate_to: "{{ item }}"
with_inventory_hostnames: xenial-group:!xenial1
재고 :이 설정이 작동하려면 있도록
[xenial-group]
xenial1 ansible_ssh_host=192.168.168.186 ansible_user=ubuntu ansible_ssh_extra_args='-o ForwardAgent=yes'
xenial2 ansible_ssh_host=192.168.168.187 ansible_user=ubuntu ansible_ssh_extra_args='-o ForwardAgent=yes'
xenial3 ansible_ssh_host=192.168.168.188 ansible_user=ubuntu ansible_ssh_extra_args='-o ForwardAgent=yes'
, synchronize
이 rsync
에 대한 래퍼입니다 것을 명심하고 ssh가 있어야 다음
는 질문에 대한 대답 대상 호스트 사이의 연결 (일반적으로 제어 호스트와 대상 호스트 사이에 ssh 연결이 있음). 나는 이것을 위해 에이전트 포워딩을 사용한다.
감사합니다. 여기에 게시하기 전에 많은 설명서를 읽습니다. 나는 예에서 부족한 문서를 찾지 못했다. 어떤 사람들은 교과서를 읽는 법을 배웁니다. –