[Spacewalk-list] Set Random Hostname During Build process (SOLUTION)

Emmett Hogan ehogan at gmail.com
Fri Mar 4 17:19:31 UTC 2016


Well…I never got a response from the list (or the IRC Channel) on this, but it turns out the solution is WAY easier than I thought, but not very intuitive.

I simply put this line in as a “PRE” bash script:

echo "network --hostname=temp-$RANDOM$RANDOM.mydomain.com" > /tmp/pre-hostname

Then put the line:

%include /tmp/pre-hostname

into the “Custom Options” box at the bottom of the “Kickstart Details” -> “Advanced Options” page for your kickstart profile.

Hopefully this will save time for other folks.

-Emmett 

From: Emmett Hogan <ehogan at gmail.com>
Reply: Emmett Hogan <ehogan at gmail.com>
Date: March 1, 2016 at 4:34:38 PM
To: spacewalk-list at redhat.com <spacewalk-list at redhat.com>
Subject:  Set Random During Build process  

Hi everyone,

I am sure this issue has been solved a thousand times, but for the life of me, my google-foo is failing and I cannot find the solution. 

Basically, all I want to do is generate a random temporary hostname when a machine is provisioned via Spacewalk.  I've thought that the right way would be a snippet that did just:

------------------------------
echo "network --hostname=temp-$RANDOM$RANDOM.mydomain.com" > /tmp/pre-hostname
%include /tmp/pre-hostname
-------------------------------

The file /tmp/pre-hostname is getting created correctly, but the "%include" isn't working. (I am assuming that it is because it's inside of a "%pre" block.

Basically, I want to be able to PXE boot a machine and have it come up with a standard (but random) temporary hostname using our default configuration.  Not localhost.localdomain.

Once the role of the machine is decided, I plan to use Chef to update the hostname, and other configurations and the Spacewalk registration.

Am I doing something blatantly stupid here?

Thanks,
Emmett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20160304/f9355d77/attachment.htm>


More information about the Spacewalk-list mailing list