
Ansible Documentation
Delegation機能
- タスクを実行するホストを指定する
- 指定するホストは inventory ファイルに記載されていなくても良い
- localhost または 127.0.0.1 を指定すると、管理サーバーを指定したことになる
例
- name: 管理サーバー上でファイルをコピーする copy: src: ~/ansible/file-a dest: ~/ansible/file-b delegate_to: localhost
- name: IP アドレスが 192.168.101.231 上のファイルの内容を表示する shell: cat ~/file-a delegate_to: 192.168.101.231 register: result