I’m new to Foreman and I’m working on a setup where I cannot use PXE for auto-discovery. I read here that you can re-provision an existing server by calling the appropriate template, something like ‘http://yourforeman.domain/unattended/provision?spoof=xx.yy.zz.xx’ (this is just to render the template)
I have the following questions:
How you can see all the available provisioning templates? I see the files on /usr/share/foreman/app/views.unattended/provisioning_templates but it is not clear to me how this are mapped to the one I see on the Web UI (https://yourforeman.domain/templates/provisioning_templates)
My foreman server is on a different subnet than the server I need to provision. I enabled ‘Token duration=largeValue’ on settings, will this be enough for Foreman to work?
I’m using the 14.0 version of the discovery plugin and Foreman ‘1.21.2’.
Thanks in advance, I can provide more details if required.
Associate “script” template with the OS your host uses. You need to do this in Provisioning Templates screen Associate tab and then in Operating System - Templates tab.
The template you want is called Grubby default (it’s quite old not sure if it will work - you might need to customize it)
Put your host into Build mode by clicking on the Build button (this will generate token)
On the host detail on the left side, copy the UUID token
You can use Templates tab and preview Script template to see it in advance and test it
Once you are happy with the result just perform curl http://foreman.example.com/unattended/script?token=UUID | bash and reboot. You can use Remote Execution for that.
If you find any problems with the template, feel free to update it here. Also get back to me with feedback, we should probably post an updated version of that old blogpost. It is also technically possible to create a Remote Execution template which will render the curl command including the token automatically so this process can be fully automated.