Karthik:
Hi Team. I want to obtain internal IP of my machine using ansible. How can I achieve it?
Mohamed Ayman:
Do you mean the ip of the target server ? if yes, so it’s correct
Karthik:
Yeah I saw that. But I need the internal IP of the target server
Mohamed Ayman:
Try this fact
ansible_all_ipv4_addresses
you will get all addresses of the server, and you can pass it to the ipaddr
filter.
{{ ansible_all_ipv4_addresses | ipaddr('private') | first }}