Hi All, I am trying to comment out a line in an SNMP conf. file using ansible. The line has some whitespaces. How can I use ansible to comment out this line. I have tried using the replace command, no joy!
hi, in your regexp you can refer your bracketed matched pattern as \1 see here as well https://www.mydailytutorials.com/uncommentcomment-lines-files-using-ansible/ also your pattern looks to be faulty check examples in docs here//docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html> I would replace spaces with \s+ also if this is a full line match I would add $ at the end… cheers.