Cloud-init userdata 404

I am using foreman 3.4.1 and trying to boot ubuntu20. also using anther server for proxy, tftp and dhcp
In foreman i have defined a ucloud-init user data template.

When i provision the host (from foreman ui) it is registered with the fallowing ip: 172.16.38.130.
When i reboot it allocates from the dhcp the fallowing temp ip: 172.16.38.129 and because the ip address is different the call to userdata fails.

Processing by UserdataController#metadata as TEXT
2023-04-01T15:45:58 [I|app|49a75511]   Parameters: {"url"=>"http://fproxy.nydc1.xxxx.com:8000", "userdatum"=>{}}
2023-04-01T15:45:58 [E|app|49a75511] Could not find host for request 172.16.38.129
2023-04-01T15:45:58 [I|app|49a75511]   Rendered text template (Duration: 0.0ms | Allocations: 1)
2023-04-01T15:45:58 [I|app|49a75511] Filter chain halted as :find_host rendered or redirected
2023-04-01T15:45:58 [I|app|49a75511] Completed 404 Not Found in 17ms (Views: 0.5ms | ActiveRecord: 5.8ms | Allocations: 2293)
2023-04-01T15:45:59 [I|app|509b3d4a] Started GET "/userdata/meta-data?url=http%3A%2F%2Ffproxy.nydc1.xxxx.com%3A8000" for 172.16.38.129 at 2023-04-01 15:45:59 -0400

but when i call manually with the previous ip address

curl -D - -H 'X-Forwarded-For: 172.16.38.130' http://172.16.38.42:8000/userdata/user-data

I get 200.

Any idea what can be done ?

1 Like