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 <[email protected]>
Reply: Emmett Hogan <[email protected]>
Date: March 1, 2016 at 4:34:38 PM
To: [email protected] <[email protected]>
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

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to