I'm new to ansible, however I was able to successfully use the blockinfile function. However I can't figure out how to prevent markers from being inserted. I read the documentation but it didn't appear to describe it.
This is what shows up in every file that blockinfile writes to.
# BEGIN ANSIBLE MANAGED BLOCK
# END ANSIBLE MANAGED BLOCK