Found the 'lineinfile' module previously non-intuitive? It's better now.

I've just pushed a fix that changes the "regexp does not match line"
logic to allow the regexp to match a /portion/ of the line, so you no
longer have to write out a full regex.

This is what it should have been anyway, and makes the module much
easier to use.

Example:

        action: lineinfile name=/var/lib/pgsql/data/pg_hba.conf
line="host ansible_commander ansible_commander 127.0.0.1/32 password"
insertafter=BOF regexp="ansible_commander"

No visible regex evil anywhere, and you can still change the database
line and it won't try to put it back.

Just be careful and supply a decent enough regular expression or it
will not stop adding lines.