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

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
主站蜘蛛池模板: 东莞市| 梧州市| 玛曲县| 陕西省| 西宁市| 新泰市| 铁岭县| 临泉县| 革吉县| 阜阳市| 肥西县| 社旗县| 罗山县| 肥西县| 西安市| 柘荣县| 昔阳县| 谢通门县| 灵宝市| 缙云县| 旅游| 尖扎县| 白玉县| 长春市| 宜兰市| 伽师县| 平邑县| 哈巴河县| 宜春市| 岳普湖县| 乌拉特后旗| 青岛市| 泰宁县| 兴国县| 托克逊县| 承德县| 武川县| 穆棱市| 十堰市| 沙雅县| 上蔡县|