Hi,
I have a csv file which has all the ip address and the mac address in
column (as shown below):
VM1 TBD x.x.x.x 02:07:C0:A8:06:04 x1.x1.x1.x1 02:07:0A:AE:CC:54
x2.x2.x2.x2 02:07:0A:91:10:BB x3.x3.x3.x3 02:07:AC:10:04:03
VM2 TBD y.y.y.y 02:07:C0:A8:06:05 y1.y1.y1.y1 02:07:0A:AE:CC:55
y2.y2.y2.y2 02:07:0A:91:10:BC y.3.y3.y3.y3 02:07:AC:10:04:04
VM3 TBD z.z.z.z 02:07:C0:A8:06:06 z1.z1.z1.z1 02:07:0A:AE:CC:56
z2.z2.z2.z2 02:07:0A:91:10:BD z3.z3.z3.z3 02:07:AC:10:04:05
Now i want to check the ip and mac combinations of mentioned in CSV, My
playbook is as follows. Want to iterate through all the ip and mac
combination and display.
but my iteration is unsuccessful. Pls help
- hosts: all
tasks:
- name: All IPV4 address in system
setup: filter="ansible_all_ipv4_addresses"
register: all_ipv4_address
- debug:
var: all_ipv4_address
- name: Ip vs Mac Inside CSV
debug:
msg: "The MAC address of {{ item }} is {{ lookup('csvfile', '{{
item }} file={{ inventory_data }} delimiter=,') }}"
with_items:
"{{ all_ipv4_address }}"
--
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/d7753723-bcf9-49ab-8da4-21797243109d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.