You could use a template like this:
{% for iface in ansible_interfaces | difference(['lo','eth0']) | sort %}
{{ iface }}: {{ hostvars[inventory_hostname]['ansible_' ~
iface]['macaddress'] }}
{% endfor %}
This will yield:
eth1: 08:00:27:b3:59:d0
eth2: 08:00:27:87:1b:de
eth3: 08:00:27:9b:80:85
eth4: 08:00:27:90:ad:eb
On Fri, 28 Jun 2019 at 07:54, Rakesh Parida <[email protected]> wrote:
>
> Hi ,
>
> My VM has 4 ip-interfaces . I want to extract a data as below using ansible.
> Interface1: macaddress
> Interface2: macaddress
> Interface3: macaddress
> Interface4: macaddress
>
> Kindly help.
>
> --
> 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/fdbcffbf-0f59-4af1-942f-a85a751237cf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
--
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/CAL8fbwP0P1aj8deX2YAvZN_VQ3sjoPQzOFR-BxwYNvJbzpD7FQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.