官术网_书友最值得收藏!

ad-hoc versus playbook: the copy module

The Ansible copy module can be used in ad hoc mode to quickly run a copy job:

ansible servers -m copy --args="src=./file1.txt dest=~/file1.txt"

The output of this command should look as follows:

Alternatively, this can be used in a playbook with various options for a personalized result:

---
- name: copy a file to hosts
hosts: servers
become: true
fast_gathering: false
tasks:
- name: copy a file to the home directory of a user
copy:
src: ./file1.txt
dest: ~/file1.txt
owner: setup
mode: 0766
主站蜘蛛池模板: 昭平县| 哈尔滨市| 嫩江县| 甘谷县| 永顺县| 井冈山市| 萨迦县| 武汉市| 正定县| 湛江市| 札达县| 北京市| 通榆县| 江安县| 西安市| 盘山县| 桓台县| 花莲市| 九江市| 尤溪县| 来宾市| 北海市| 犍为县| 榆中县| 封丘县| 永泰县| 外汇| 依安县| 侯马市| 四子王旗| 榆社县| 买车| 保山市| 郁南县| 江源县| 马公市| 新乡县| 枣强县| 临朐县| 济源市| 且末县|