title: Ansible "lineinfile": add new line (with PATH=) or append to existing line (with PATH=)
body: <p>I am trying to replace or append a path part to the path definition in /etc/environment on a linux box.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>//all.yml
  my_path: "/usr/bin:/usr/sbin"
  my_extra_path: "/usr/extra/path"
  </code></pre>
  
  <p>In my role-file:</p>
  
  <pre><code>//updatePath.yml
  - name: update /etc/environment
    lineinfile:
      dest=/etc/environment
      state=present
      backrefs=yes
      regexp='PATH=({{ my_path }}:?)?({{ my_extra_path }}:?)?(.*)'
      line='PATH={{ my_extra_path }}:{{ my_extra_path }}:\3'
  </code></pre>
  
  <p>Now when I run the role, it works fine updating an existing PATH-line, but not creating duplicates within the line or even duplicate lines. So far so good.</p>
  
  <p>When there is no line with "PATH=" present, I would expect it to add a new one. But it doesn't.</p>
  
  <p>Is my expectation wrong or where lies the problem?</p>