User_data template - @host.ip

I'm trying to populate my host file with an entry through my user_data
template. During the build, the user_data template queries for @host.ip. My
issue is it doesn't return anything so my host file is missing the ip
address of the host. It eventually populates but now when i initially build
my machine. I'm building my machine with a python script through the
foreman api. Can someone tell me when the host ip gets populated into the
database?
Thanks
Vic