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

 

你可能感兴趣的:(Ansible infile模块)