Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible: Is it possible to search replace single word

Tags:

In the lineinfile module, it replaces the full line.

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

Let us suppose I want to replace the single word in the file:

#abc.conf
This is my horse

this is the playbook:

 - lineinfile: dest=abc.conf
               state=present
               regexp='horse'
               line='This is my dog'
               backup=yes

is there any way to achieve someting like sed 's/horse/dog/g' ?