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

  • 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
主站蜘蛛池模板: 汽车| 扎囊县| 牙克石市| 凤凰县| 宁都县| 萝北县| 定西市| 七台河市| 库伦旗| 定边县| 康保县| 波密县| 深水埗区| 安化县| 夏河县| 苏尼特左旗| 楚雄市| 临海市| 年辖:市辖区| 尤溪县| 遵化市| 郑州市| 财经| 鄯善县| 曲松县| 马尔康县| 九龙县| 德保县| 商水县| 获嘉县| 缙云县| 盐山县| 巴彦县| 丰原市| 礼泉县| 内乡县| 北安市| 洮南市| 青龙| 汉川市| 石嘴山市|