I found this blockinfile issue, where a user suggested adding a number after the \"|\" in the \"block: |\" line, but gives a syntax error. Basically, I want to use blockinfile m
You can use a YAML feature called "Block Indentation Indicator":
- name: Added a block of lines in the file
blockinfile:
dest: /path/some_file.yml
insertafter: 'authc:'
block: |2
line0
line1
line2
line3
line4
It's all about the 2 after the |
References: