title: Is it possible to use variable in path with lineinfile ansible module?
body: <p>I have a playbook</p>
  
  <pre><code>---
  - hosts: 127.0.0.1
    connection: local
  
    vars:
      WORK_DIR: /somefolder
  
    tasks:
  
    - debug:
        msg: "{{ WORK_DIR }}"
  
    - lineinfile:
        path: /somefolder/some.file
        regexp: '"display_name":'
        line: '  "display_name": "another_name",'
  </code></pre>
  
  <p>works fine and I have a debug</p>
  
  <pre><code>ok: [127.0.0.1] =&gt; {
      "msg": "/somefolder"
  }
  </code></pre>
  
  <p>but when I try to use variable in path like</p>
  
  <hr>
  
  <pre><code>- hosts: 127.0.0.1
    connection: local
  
    vars:
      WORK_DIR: /somefolder
  
    tasks:
  
    - debug:
        msg: "{{ WORK_DIR }}"
  
    - lineinfile:
        path: "{{ WORK_DIR }}"/some.file
        regexp: '"display_name":'
        line: '  "display_name": "another_name",'
  </code></pre>
  
  <p>there is an error</p>
  
  <pre><code>- lineinfile:
      path: "{{ WORK_DIR }}"/some.file
                            ^ here
  </code></pre>
  
  <p>The question is why ? Is this a bug or feature or something else ?</p>