Quantcast
Viewing latest article 33
Browse Latest Browse All 41

Answer by Zoredache for Ansible hostname resolution with ipaddr filter returns False?

The ipv4 filter is not a name resolution filter. It simply tests if the passed string is a valid IPv4 address.

If you want to resolve a DNS address you probably should be using the lookup plugin 'dig'.

https://docs.ansible.com/ansible/latest/plugins/lookup/dig.html

Example

$ ansible localhost -m debug \  -a 'msg={{lookup("dig","www.google.com/a",wantlist=true)|first}}'localhost | SUCCESS => {"msg": "172.217.14.196"}

Viewing latest article 33
Browse Latest Browse All 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>