Assuming you have all macs in a list:
- name: process mac addresses into a list
set_fact:
result: "{{result | default([]) | union([ 'Interface' + idx|string
+ ': ' + item]) }}"
loop: "{{macs}}"
loop_control:
index_var: idx
- name: set fact
set_fact:
final: "{{result|join('\n')}}"
On Fri, 28 Jun 2019 at 11:24, 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
> <https://groups.google.com/d/msgid/ansible-project/fdbcffbf-0f59-4af1-942f-a85a751237cf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CAFXWBQK8igaNJ8DymSQ9C%2Bave9W3%2BDpdOnByDyEV4AOiqHhh8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.