I have one question to the VMware notes section in the current Foreman doc: If I make the adjustments for SSH-less configuration (using user-data template), how does Foreman/VMware apply the user-data template to the freshly created VM?
I found an interesting sequence diagram that visualizes how the image based approach works, but it doesn’t reflect the non-ssh way - atleast I don’t understand it.
There are a lot of topics regarding user-data templates and non-SSH deployment, though none fully cleared my misunderstanding. Apologies in advance if I add to the stack unnecessarily
Thanks Timo, that page certainly helps the non-ssh deployment in more detail.
Since the userdata plugin is now part of Foreman core, should the curl command mentioned in the debugging section work “out of the box”? (assumed a VM was deployed with the given IP)
Riiight, I coul’ve tried this on my own, thanks again.
One more question if you don’t mind: It seems Foreman searches for hosts using the requests IP even though the X-FORWARDED-FOR header is applied. Does the command work for you?
curl -D -verbose -H 'X-FORWARDED-FOR: 10.35.147.110' http://v000398/userdata/user-data
Could not find host for request 10.51.6.160
2019-11-22T15:15:07 [I|app|a4951657] Started GET "/userdata/user-data" for 10.51.6.160 at 2019-11-22 15:15:07 +0000
2019-11-22T15:15:07 [I|app|a4951657] Processing by UserdataController#userdata as TEXT
2019-11-22T15:15:07 [E|app|a4951657] Could not find host for request *10.51.6.160*
2019-11-22T15:15:07 [I|app|a4951657] Rendering text template
2019-11-22T15:15:07 [I|app|a4951657] Rendered text template (0.0ms)
2019-11-22T15:15:07 [I|app|a4951657] Filter chain halted as :find_host rendered or redirected
2019-11-22T15:15:07 [I|app|a4951657] Completed 404 Not Found in 16ms (Views: 0.5ms | ActiveRecord: 7.1ms)
So it turns out Vmware deploys the rendered template to the newly provisioned instance, but doesn’t apply the changes. I can see two files in the /etc/netplan/ directory:
And it seems that the cloud init template is applied instead of the vmware netcfg. I don’t know about netplan, so I will pursue some more research on how to select a default.
After I removed the 50-cloud-init.yaml file and rebootet, the VM used the remaining netplan file to configure the interface. I created a new template based on that change and redeployed a test VM. Result: All good now.