Yes, that worked - I am kicking myself a bit - thanks again. It's a bit of
a counter-intuitive view to the data structure for me. One you explained
about fred being the key it became clear. Thanks for the explanation.
On Monday, 24 November 2014 14:44:00 UTC, Michael Peters wrote:
>
> In this case "fred" is the key to the exports dictionary. It can't be
> both the key and the entry itself. Try something like:
>
> {{ fred }}
> {{ exports[fred].options }}
>
> On Sun, Nov 23, 2014 at 6:35 AM, Stephen Tan <[email protected]
> <javascript:>> wrote:
> > Hi - I'm doing something which seems very simple - trying to create a
> file
> > from a jinja template.
> >
> > Here are my vars:
> >
> > export_root:
> > host: "81.187.209.128/27"
> > options: "rw,fsid=0,insecure,no_subtree_check,async"
> > exports:
> > video:
> > host: "81.187.209.128/27"
> > options: "rw,nohide,insecure,no_subtree_check,async"
> > shared_dir: "/mnt/video"
> >
> > Here is the template which I'm using the test var fred:
> >
> > {{export_root_dir}} {{export_root.host}}({{export_root.options}})
> > {% for fred in exports %}
> > {{ fred }}
> > {{ fred.options }}
> > {% endfor %}
> >
> > For some reason, fred.options fails with:
> >
> > fatal: [althea.home.stanandliz.net] => {'msg': "One or more undefined
> > variables: 'str object' has no attribute 'options'", 'failed': True}
> > fatal: [althea.home.stanandliz.net] => {'msg': "One or more undefined
> > variables: 'str object' has no attribute 'options'", 'failed': True}
> >
> > I have no idea why this should be the case. When I access fred, the
> template
> > prints fine. It's when I try to access the dictionary in fred that I
> fail.
> >
> > I'm sure there is a very simple fix to this, but after about an hour, I
> just
> > can't get this to work. Can I have a few debugging clues?
> >
> > many thanks in advance
> >
> > Stephen
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/0b1cdc31-1ab2-449b-a91f-6f138cc5516c%40googlegroups.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1cd630e5-b14d-4f4c-ba48-3b557937ace2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.