ansible modify file content

# Match content, modify the content if the match is successful, add content if the match fails

- name: add or modify a line

  lineinfile:

    dest: /tmp/test.txt

    regex: '^What needs to be replaced'

    line: 'new content'

Guess you like

Origin blog.csdn.net/love_THL/article/details/127431470