.FogSettings Auto Edit IP and Hostname
I have an image of Ubuntu with the fog files ready to be installed that we use to push out our fog nodes at our different sites. the problem I am having is that every time we deploy a node, we have to manually edit the .fogsettings file to set the new IP Address and the new Hostname. Is there a way to Change the Server IP Address and the Hostname by having it pull them automatically from the current system being setup?
@FlareImp Well, why don’t you generate the .fogsettings file with the right IP and hostname before running the FOG installer?
@sebastian-roth I don’t follow
@flareimp I’m a bit confused here too.
we have to manually edit the .fogsettings file to set the new IP Address and the new Hostname
Are you creating multiple instances of a FOG server? Kind of using a fog server to deploy a new fog server? The .fogsettings file is only used during the setup and then upgrade of a fog server, never for image deployment.
@george1421 Sorry for not being clear. I uploaded an image of Ubuntu with the fog install files and .fogsettings already loaded onto it. All a tech needs to do is change the .fogsettings file to match the node they are imaging and then re-run the fog installer with the -y command. currently after imaging they need to nano into the .fogsettings file and manually set the ip address and the hostname for that machine before running the installer. I am trying to get it to where when we image a node it can be auto installed rather than have someone set it up.
@flareimp Ah ok. You will want to do that with a post install script. A post install script will execute just after the image is pushed to the computer and just before the cloning completes.
With the post install script the ideal is to connect to the deployed image’s hard drive, make the adjustments to the .fogsettings file. The continue on with the reset of imaging. The only thing you will need to do before you capture the image is create a script that will run within the context of the newly imaged computer to run the installer command with the -y to execute the installer. Before SystemD (i.e. SysV) I would just create a 99local file in the startup folder that would execute the first time boot up commands. That 99local script would then remove itself from the startup folder so it would only execute once. There maybe something more elegant that can be done with SystemD.
The basic concepts are laid out here. I know this post is windows centric, but the way we go about it is very similar under linux. I just haven’t had a chance to write a linux equivalent of this tutorial: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed
@george1421 Okay, thank you very much!
@flareimp There’s other options as well. You could do either of the below.
The below script is a one-use script that someone could run manually. After updating the IP via the OS configuration, you can run this script that will update all the FOG IP bits for you.
This next script below will continuously update FOG’s IP settings to match the local interface IP address. You could package this with the fog server image you have so everything just works out-of-box.