title: Ansible uncomment line in file
body: <p>I want to uncomment a line in file <code>sshd_config</code> by using Ansible and I have the following working configuration:</p>
  
  <pre><code>- name: Uncomment line from /etc/ssh/sshd_config
      lineinfile:
        dest: /etc/ssh/sshd_config
        regexp: '^#AuthorizedKeysFile'
        line: 'AuthorizedKeysFile    .ssh/authorized_keys'
  </code></pre>
  
  <p>However this config only works if the line starts by <code>#AuthorizedKeysFile</code>, but it won't work if the line starts by <code># AuthorizedKeysFile</code> or <code>#  AuthorizedKeysFile</code> (spaces between <code>#</code> and the words).</p>
  
  <p>How can I configure the regexp so it won't take into account any number of spaces after '#'?</p>
  
  <hr>
  
  <p>I've tried to add another lineinfile option with a space after '#', but this is not a good solution:</p>
  
  <pre><code>- name: Uncomment line from /etc/ssh/sshd_config
      lineinfile:
        dest: /etc/ssh/sshd_config
        regexp: '# AuthorizedKeysFile'
        line: 'AuthorizedKeysFile    .ssh/authorized_keys'
  </code></pre>