title: Ansible lineinfile module to replace
body: <p>I have been trying to replace a option  #$ActionFileEnableSync on
  for /etc/rsyslog.conf file with $ActionFileEnableSync on. I have used replace module</p>
  
  <pre><code>- replace:
        path: /etc/rsyslog.conf
        regexp: '^#\s*^$\s*ActionFileEnableSync on.*$'
        line: '$ActionFileEnableSync on'
  </code></pre>
  
  <p>And also I have tried to use lineinfile module</p>
  
  <pre><code> - lineinfile:
          dest: /etc/rsyslog.conf
          regexp: (^#\\$ActionFileEnableSync on)
          line: "$ActionFileEnableSync on"
  </code></pre>
  
  <p>But none seems to work,either it doesn't replace or keeps on adding a new line</p>