You could use a custom grain. Create file _grains/fqdn_ip.py in the state tree directory:
import socket
def fqdn_ip():
return {
'fqdn_ip': socket.gethostbyname(socket.getfqdn())
}
In template:
{{ grains.fqdn_ip }}
Another way is use dnsutil module (requires dig command on minion):
{{ salt['dnsutil.A']('host.name.tld')[0] }}