Ansible infile模块

lineinfile 向文本中添加单行

blockinfile 向文本中添加多行

---
- name: lineinfile
  hosts: dev
  tasks:
    - name: lineinfile
      lineinfile:
        path: /tmp/test.txt
        line: 'Add this line to the file'
        state: present
- name: blockinfile blockinfile: path: /tmp/test.txt block: | One night in beijing Two night in shanghai state: present

 

posted @ 2020-04-01 17:38  Vincen_shen  阅读(257)  评论(0编辑  收藏  举报