title: Ansible escape * in regex
body: <p>I'm trying to use Ansible's <a href="http://docs.ansible.com/ansible/lineinfile_module.html" rel="noreferrer">lineinfile module</a> to ensure that a line beginning with a * is present in a file. However, the task fails every time with the following error</p>
  
  <pre><code>TASK: [nginx | Persist soft ulimit] *******************************************
  failed: [aa.bb.cc.dd] =&gt; {"failed": true, "parsed": false}
  BECOME-SUCCESS-xbfifannrufpkcmmfmtdigorggzvhzsx
  Traceback (most recent call last):
    File "/home/ubuntu/.ansible/tmp/ansible-tmp-1442590356.11-253796220854159/lineinfile", line 2210, in &lt;module&gt;
      main()
    File "/home/ubuntu/.ansible/tmp/ansible-tmp-1442590356.11-253796220854159/lineinfile", line 394, in main
      ins_aft, ins_bef, create, backup, backrefs)
    File "/home/ubuntu/.ansible/tmp/ansible-tmp-1442590356.11-253796220854159/lineinfile", line 208, in present
      mre = re.compile(regexp)
    File "/usr/lib/python2.7/re.py", line 190, in compile
      return _compile(pattern, flags)
    File "/usr/lib/python2.7/re.py", line 244, in _compile
      raise error, v # invalid expression
  sre_constants.error: nothing to repeat
  OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
  debug1: Reading configuration data /Users/xyz/.ssh/config
  debug1: Reading configuration data /etc/ssh_config
  debug1: /etc/ssh_config line 20: Applying options for *
  debug1: auto-mux: Trying existing master
  debug1: mux_client_request_session: master session id: 2
  Shared connection to aa.bb.cc.dd closed.
  </code></pre>
  
  <p>The task is as follows</p>
  
  <pre><code>- name: Persist soft ulimit
    lineinfile:
      dest: /etc/security/limits.conf
      regexp: "^\* soft nofile"
      line: "* soft nofile 9000" 
  </code></pre>
  
  <p>Given typical escaping of regex, I'd assumed that it'd be escaped with \, but I just get the above error.</p>
  
  <p>Ansible is 1.9.2</p>
  
  <pre><code>$ ansible --version
  $ ansible 1.9.2
  </code></pre>