I have a simple file at /etc/foo.txt. The file contains the following:
#bar
I have the following ansible playbook task to uncomment the line ab
See https://github.com/ansible/ansible/issues/4531.
The solution is to not replace the commented out line, but to add an additional line, while keeping the original there.