Set Environment help

Hi ,

I’m using the following to set the environment for an already extracted package to append to PATH

`

  • name: Set Environment
    lineinfile: dest=‘/etc/environment’ state=present backrefs=yes regexp=‘PATH=(["])((?!.?{{append_var}}).?)(["])$’ line=“PATH=\1\2:{{append_var}}\3”
    `

The append_var has been declared as follows
append_var:'/srv/chat/erlang/bin:/srv/chat/erlang/lib:/srv/chat/ejabberd/bin:/srv/chat/ejabberd/etc:/srv/chat/ejabberd/lib:/srv/chat/ejabberd/sbin:/srv/chat/ejabberd/share:/srv/chat/ejabberd/var/'

While the playbook is executed it returns the below error

`
Note: The error may actually appear before this position: line 7, column 15

  • name: Set Environment
    lineinfile: dest=‘/etc/environment’ state=present backrefs=yes regexp=‘PATH=(["])((?!.?{{append_var}}).?)(["])$’ line=“PATH=\1\2:{{append_var}}\3”
    ^
    We could be wrong, but this one looks like it might be an issue with
    missing quotes. Always quote template expression brackets when they
    start a value. For instance:
    with_items:
  • {{ foo }}
    Should be written as:
    with_items:
  • “{{ foo }}”
    `

Please guide if I’m missing some expressions

The last trailing / was removed from the variable and it worked .

The /etc/environment still does not reflect the new path