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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2021-09-23
  • 2021-09-16
  • 2021-09-09
  • 2021-12-04
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-09-01
  • 2022-12-23
相关资源
相似解决方案