I'm going to guess that you probably don't have facts cached (or the cache
has expired) for the hosts where the variable is undefined.

On Wed, Aug 21, 2019, 5:15 PM Dennis H <[email protected]> wrote:

> So I'm trying to combine magic variables and jinja. Unfortnately I'm
> running into issues. So This is the jinja script
>
> {% for host in groups['all'] %}
>
> {{
> hostvars[host]['ansible_facts']['devices']['sda']['partitions']['sda1']['size']
> }}
>
> {% endfor %}
>
> I run into this error
>
> "AnsibleUndefinedVariable: 'dict object' has no attribute 'devices'" }
>
> This works when I target a group with one managed host but not one with
> multiple managedhosts. I have tried with hostvars['host'] and no luck...
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/3680213a-28fc-4858-a800-f0856fbecd3c%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFbiokcKH-PNqYkC2X1CcZ0MQNrCGXac4aJGgDHROMh7YLkBrw%40mail.gmail.com.

Reply via email to