blockinfline module

You need to add a "marker" in order NOT to overwrite current content.

For example usage, see github.com/promet/pstools.git and head over to promet-ansible branch & ansible-promet-apacheconfig/tasks/main.yml

Syntax guide https://docs.ansible.com/ansible/latest/modules/blockinfile_module.html

Some tutorial online http://www.mydailytutorials.com/ansible-blockinfile-module-adding-multiple-lines/