Lenses are hard for people to write and error handling is poor though, so it can be very frustrating. The lineinfile method does work fine for simple files, and there's also an INI file module.
In most cases, we recommend using the 'template' module for this reason, in cases where you know what you'd like to put down for the file contents.
In most cases, we recommend using the 'template' module for this reason, in cases where you know what you'd like to put down for the file contents.