Script control of fog
Hello I am sorry if this has been answered before I could not find an answer.
I am currently working with Fog version .32 on ubuntu 13.10
I would like to know if it is possible to control what image is associated to a computer by a script.
Ideal situation would be run a script that sets a registered computer to selected OS and selected image then create a task to deploy the image to that computer.
I am looking to do it this way because I am being asked for a solution that would allow us to image a computer with multiple operating systems both windows and linux. I know it is possible to do this in the Gui however I would like to be able to do these changes with a script so I can have one script that installs windows 7 to the machine with one click and another that would install Fedora 19 on that same machine and so on.
Thank you chad.
You just need to fake it. Run a mysql script that updates the hostOS and hostImage values, create the pxe file for the host and create the task record in the database. Then call the wol.php file from the command line with the mac address of the host you want to wake up.
To get you started, associate the host with one image and OS, create a deploy task with the machine off/unplugged. Then inspect the /tftpboot/01-[mac-address] file for the options. Then query mysql tasks table for the values you’ll need there.
Thank you for your quick response.
From what I understand the quick registration will image the computer with a chosen image and register it. Then if I wanted to change the image I would need to unregister the computer and change the image associated with the quick registration or do it from the web interface. From what I can tell this would not help in my situation.
I will explain my situation in full. We will have a rack with 4 machines that we will use for testing. These four machines need to be able to run windows xp and up. They will also need to be able to run several versions of linux. Raw images are acceptable if needed.
This test rack will also have an optical switch connected to pci cards and managed power strip. I hope to be able to have it setup at some point where I could run a script that would turn on a machine and install a selected operating system and then also set the optical switch to connect a pci card to that computer. The script would then install selected software onto the machine and then run the software.
I know Fog does not support snap-ins for linux we can work on are own solution to remotely install the software.
The part with fog is being able to tell fog what computer needs to be imaged and what image to use. using some sort of command and not the web interface. I am not at the point where I need to start testing this capability however my manager would like to know if this is possible and if it might need some extra work in order to make it work for us.
Maybe QUICK_REG_AUTOPOPP might work better for you?
You’d have to remove the registered hosts you want this perform the trick on, then perform quick registration. You set the OSID on the same place you enable QUICK_REG_AUTOPOP. Then the hosts will be registred per your AUTOREGSYSNAME and Image ID, and then will reimage accordingly.