replice line - xmlangel/ansible GitHub Wiki

In the lineinfile module, it replaces the full line.

If the line is long I have to repeat the whole line again.

#abc.conf
This is my horse
this is the playbook:

is there any way to achieve someting like

sed 's/horse/dog/g' ?
 - lineinfile: dest=abc.conf
               state=present
               regexp='^(.*)horse(.*)$'
               line='\1dog\2'
               backup=yes
               backrefs=yes