There will be cleaner ways to do this once jinja2.7 becomes more
readily available, but for now you could probably simulate the above
loop with 'with_items' and a 'when' conditional:
tasks:
- name: ipv6 link local
debug: msg="{{ item.address }}"
when: item.scope == 'link'
with_items: ansible_em1.ipv6
Yes, this is an ugly hack.
K
Kahlil (Kal) Hodgson GPG: C9A02289
Head of Technology (m) +61 (0) 4 2573 0382
DealMax Pty Ltd (w) +61 (0) 3 9008 5281
Suite 1415
401 Docklands Drive
Docklands VIC 3008 Australia
"All parts should go together without forcing. You must remember that
the parts you are reassembling were disassembled by you. Therefore,
if you can't get them together again, there must be a reason. By all
means, do not use a hammer." -- IBM maintenance manual, 1925
On Sun, Dec 29, 2013 at 10:30 AM, Anand Buddhdev <[email protected]> wrote:
> Hello ansible people,
>
> I want to extract an interface's IPv6 link-local address from facts. I've
> figured out a round-about way of doing this in a template. I do:
>
> {% for v6 in hostvars[inventory_hostname]['ansible_em1']['ipv6'] %}
>
> {% if v6.scope == 'link' %}
>
> {{v6.address}};
>
> {% endif %}
>
> {% endfor %}
>
> However, I don't know how to do this in a playbook where I wish to use the
> link-local address in a task. Any suggestions?
>
> Regards,
>
> Anand
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
--
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].
For more options, visit https://groups.google.com/groups/opt_out.