prudhvi
prudhvi

Reputation: 1171

Replacing a line of a file using Ansible

I have a Redhat machine which is my remote machine. And in that, there is a line which I have to replace :

server 0.rhel.pool.ntp.org iburst

to

#server 0.rhel.pool.ntp.org iburst

I have tried using replace module, but I am doing it wrong. How to do it??

Upvotes: 0

Views: 2512

Answers (1)

Nasr
Nasr

Reputation: 2632

Using replace

- replace: 
  dest=FILE_PATH 
  regexp='server 0.rhel.pool.ntp.org iburst' 
  replace='#server 0.rhel.pool.ntp.org iburst'

Upvotes: 1

Related Questions