远程拷贝到远程
---
- hosts: all
tasks:
- name: 复制文件
copy:
src: /home/test.txt
dest: "/home/test123.txt"
remote_src: True
owner: root
group: root
mode: 0644
本地拷贝到远程
---
- hosts: all
tasks:
- name: 复制文件
copy:
src: /home/test.txt
dest: "/home/test123.txt"
owner: root
group: root
mode: 0644
拷贝内容
- name: 写入文件
copy: dest=/home/test.txt content="test123"
修改文件
---
- hosts: all
tasks:
- name: 修改文件
lineinfile:
dest: "/home/test.txt"
regexp: "test"
line: "test-123"
state: present
文章评论