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

  • Ansible Quick Start Guide
  • Mohamed Alibi
  • 87字
  • 2021-07-23 16:37:47

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
主站蜘蛛池模板: 永新县| 平江县| 招远市| 寻甸| 五莲县| 县级市| 句容市| 吴桥县| 长武县| 永兴县| 安吉县| 阿克陶县| 壤塘县| 定南县| 临漳县| 蒲城县| 七台河市| 沅江市| 珲春市| 安龙县| 五莲县| 怀远县| 定安县| 阳泉市| 西平县| 油尖旺区| 滨州市| 丹江口市| 安多县| 崇文区| 嵊州市| 奉贤区| 黑龙江省| 淮安市| 和平区| 桐城市| 南靖县| 凭祥市| 沁阳市| 上栗县| 西青区|