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
原文地址:https://www.cnblogs.com/vincenshen/p/12614146.html