#ansible - October 2021

ansibleArchived
2 messages

Discussions related to ansible configuration management

October 2021
Ozzy Aluyi
Ozzy Aluyiabout 5 years ago
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!
Ozzy Aluyi
Ozzy Aluyiabout 5 years ago
- name: Comment out agent address.
    replace:    
      path: /etc/snmp/snmpd.conf
      regexp: '^(.*agentaddress  127.0.0.1,[::1].*)'
      replace: '#agentaddress  127.0.0.1,[::1]'