How to pass host-specific settings into host after deploying image
I would like to pass a text file with host specific settings (like hostname, etc.) to a Linux host, so that on first startup after imaging, the host can perform some specific customization tasks.
I am guessing that ‘postdownloadscripts’ are the appropriate mechanism…? How do I target a specific file with specific settings to a specific host?
A simple end-to-end working example would be greatly appreciated!
@joseheitor The short answer is you are correct a post install script is what you need. We don’t have a tutorial on this for a linux target computer, but we do for a windows target computer. The concepts are the same between the two platforms. I have to admit it a bit easier for linux since the FOG deployment engine is based on linux already.
This tutorial gives you the framework you need: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed
The fog.custominstall script checks to see if its a windows platform by the $osid variable then loops through the disk partitions looking for the fs type of ntfs, if found it tries to detect the windows folder. If you know the partition number already you can just do the direct mount of the directory onto the mount directory you create. From there is just piping the variables you need into a text file on the target computer.
@george1421 - Thanks.
Is there a way to initially just start an interactive shell, so that I can test all the individual commands that will eventually make up the unattended script?
@joseheitor Yes the easiest way is to schedule a debug deployment. Before you hit the schedule task button, tick the debug checkbox. PXE boot the target computer, after a few screens of text you need to clear with the enter key you will be dropped to the FOS Linux command shell. Kye in
fogto start the deployment process in single step mode.
What I would do first is edit the fog.powerdownload script and put an echo statement like “script is running” then enter a
debugPauseafter. When you see the script is running text and the pause afterwards you can hit a ctrl-c to drop out to a command shell. Your context will be as the script is running so you will have access to the fog variables. you can see them using the
set | morecommand.
Once you have your post deployment script figured out you can restart the deployment process by just rerunning the
fogcommand. You don’t need to reboot the target computer as long as you don’t let the script run past the post install script spot.
@george1421 Fantastic! Many thanks.