reffering variables inside vars.yml

I guys, ansible newbie here…

I’ve read how to refere variables inside vars.yml file here:
http://www.ansibleworks.com/docs/YAMLSyntax.html

foo: 1
foo_value: {{ foo }}

then under my playbook.yml load vars.yml with vars_file: directive and call them with {{ foo_value }}.
This is working fine but, what about this:

foo:
bar: hello
baz: {{ bar }}

and call it under the play with {{ foo.baz }}.
Is there a way to do this?

I’ve tried this 4 ways but wihout success… http://pastie.org/8514924

help :slight_smile:

cheers,
Frank

I guess your problem is the missing quotes, check below an example from Michael last month

  • hosts: all
    vars:
    cat: yes
    x: 42
    decoded:
    home: “/usr/bob”
    moo: yes
    xyz: “{{ decoded.home }}”
    glorp: “{{ raz }}”
    fish: “{{ decoded.xyz }}”
    baz: “{{ fish }}”
    raz: “{{ decoded.moo }}”

When posting a problem, it always helps to state what the problem you are seeing actually is.

Otherwise, how are we to guess? :slight_smile: