On Mon, 9 Mar 2020 06:06:39 -0700 (PDT)
Sanjay <
sanjay...@gmail.com> wrote:
> Any idea/comments why this doesn't work?
> Installed aversion - 2.9.0
>
> Playbook : test.yml
> --
> - name: substitute vars
> hosts: localhost
> gather_facts: False
> vars_files:
> - "vars.yml"
> tasks:
> - name: print vars
> debug: msg="{{ vars.a }}"
>
> vars.yml
> a: "{{ lookup('env', 'HOME') }}"
>
> Output :
> TASK [print vars]
> ok: [localhost] => {
> "msg": "{{ lookup('env', 'HOME') }}"
> }
>
> Why it doesn't print the HOME env value?
There is no reason toreference "vars". Try
debug: msg="{{ a }}"
HTH,
-vlado