Provision with Script
-
Hi guys. I have used Fog for a while and definitely this is a great project and saves a lot of my time on provisioning new machine.
Does Fog have a feature that allows us to run script after it finishes provisioning, just like building AWS EC2 instance? Could that be a feature request if it does not exist?
Thanks
-
I’m not sure what you mean by “after it finishes provisioning”
FOG images machines, pure and simple.
We have the FOG Client that can do some alternate things such as: Printer Management, Snapins - Essentially run scripts or program installations – needs to be silently, Hostname Changing, Domain Joining, Display management, Auto Logout, Power Management - where you can schedule instant or regularly run (Wake ups, Shutdowns, Reboots), User Login/Out Tracking, Task Reboots, and/or Host registration - Client will register the host for you in a pending status, awaiting for an admin to approve the registration of said host.
However, if you mean, in terms of imaging, do we have the ability to run scripts after imaging is complete, then the answer is yes.
We have two features, post-init (which will run special scripts you create and define) before imaging process begins, as well as post-download scripts (which will run special scripts you create and define) after the imaging process completes.
Hopefully this helps explain things a little better on what FOG does, can do, and is limited to.
Thank you,
-
This helps a lot. This is an amazing project
-
@zfeng So to add on to the information Tom provided, the FOG post init (before imaging) and post install (after imaging) scripts are executed by the FOS Linux engine (the customized linux OS that runs on the target computer for capturing and deploying images). So the post init and post install scripts need to be written in a bash shell script. That will be run within the context of the target computer. So if you can create an AWS EC2 instance from a linux command line then you might be able to do it in a FOG script. You also have to be aware that FOS Linux is a very small and fast OS, its not a full linux distribution so not all of the programs on a full linux distro are on FOS Linux. That’s not saying they can’t be, just they might not be today.
-
Thanks so much for your info. Basically, the way I use the FOG is to provision physical computer. After the imaging process is complete, I would like to run some kind of script on the target system, such as making
curl
request to download something. I don’t know if that is possible with FOG @george1421 -
@zfeng Yes FOG Linux has the curl command because it uses that and a few other commands to “talk” to the fog server during imaging.
One could (in a post install script) mount the target hard drive and then use a properly crafted wget or curl call to download a file onto the target hard drive. Unmount the target hard drive then complete the FOG imaging process.
-
@george1421 I think I need to be more precise. Let’s say that the image is deployed properly. Is that a way I can run script just like you can run that on the terminal? For now, after I complete the imaging provision, I have to power up the computer and run customized script to download something and install certain package which is must be done after the imaging process.I am sorry if I did not make the point clear
-
@george1421 I basically want to eliminate the part that I need to run the script after the provision is done.
-
@zfeng You can download the “something” and write it to the target hard drive, but you can not “install it” because it would install within the context of FOS Linux which runs from RAM. When the computer is rebooted fos linux is gone.
BUT what you can do is download something to the target computer and then create a file in /etc/init.d on the target disk (you will probably need to create the sym link in proper init folder so that it will run in the proper startup mode). Lets say you created a file call S99local and in that batch file you placed the commands to run the thing that FOS Linux downloaded and stored on the target computer. Once the script ran it would delete the /etc/init.d/S99local script so it wouldn’t run each time the system booted. That way FOS LInux could download (or copy the something from the FOG server) and when the target computer booted the first time it would run the script to install it.
-
@zfeng Of course that assumes you are installing linux on a target computer. If it was a windows OS on the target computer we still could do something similar you would just have to change how the script or PS was launched by updating the windows registry for run once with a FOS Linux post install script.
-
or run the script with the fog client as a snapin
-
@george1421 Thing is getting more clear. However, I still need some help. The reason why I need run script every time after I provision the computer is because with different computer I need to download different stuff for the different computer. Let’s say that I have computerA and computerB that I need to provision. How can I possibly specify argument with script, such as,
Computer=ComputerA ./script.sh
on the home directory? -
@Junkhacker can I run that on the home directory after the computer finishes provisioning? Thanks for jumping in
-
@zfeng variables such as the host name are available for use scripting within FOS. this info comes from the host’s profile that gets created when you register a host with FOG.
-
@zfeng if you give some more info on what the script is actually doing, we might be able to help you find the best solution faster
-
@Junkhacker hostname is part of the script. I also need to do something else such as downloading a particular file with specific variable passed from the argument
-
@zfeng this is very vague
-
@Junkhacker the script will install different projects from git repository. everyone of the them needs to have an argument to install specific package on the computer.
For now, after I complete the provision part, I basically power up the computer and run
Computer=ComputerA ./start.sh
on the home directory. -
@Junkhacker I am sorry for not specific enough
-
@zfeng I’m guessing the image is Linux based?