<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>We put down a temporary rc.local at kickstart time that, when executed, runs host name-ctl, the removes itself.</div><div><br></div><div>-Scott</div><div><br>On Apr 30, 2015, at 4:44 PM, Lightner, Jeff <<a href="mailto:JLightner@dsservices.com">JLightner@dsservices.com</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">In the RHEL7 discussion at RedHat meetup this week they mentioned this issue is addressed in RHEL7.1.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:ale-bounces@ale.org">ale-bounces@ale.org</a> [<a href="mailto:ale-bounces@ale.org">mailto:ale-bounces@ale.org</a>]
<b>On Behalf Of </b>Brian Mathis<br>
<b>Sent:</b> Thursday, April 30, 2015 4:17 PM<br>
<b>To:</b> Atlanta Linux Enthusiasts<br>
<b>Subject:</b> Re: [ale] Set hostname in RHEL 7 kickstart?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Set the hostname by making a tmp file with the 'network' kickstart command in the %pre script like this:<br>
echo "network --device=ens192 --hostname=${HOSTNAME}" > /tmp/ks-network-hostname<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">then include that file in the kickstart commands section of the file like this:<br>
%include /tmp/ks-network-hostname<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Overwriting the files like you're doing is a blunt instrument and is sure to fail at some point (like you're seeing). Use the kickstart commands as much as possible so anaconda can do the right thing. I also
treat every major release as a *major* release, which requires a complete review and rewrite to adapt to whatever changes were made.<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"MS Mincho"">❧</span> Brian Mathis<o:p></o:p></p>
</div>
<p class="MsoNormal">@orev<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Apr 30, 2015 at 2:53 PM, James Sumners <<a href="mailto:james.sumners@gmail.com" target="_blank">james.sumners@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<p class="MsoNormal">I have a post script to set network configurations that gets used in all of my kickstarts:<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">```<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">exec 6<&1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">exec > /etc/sysconfig/network<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">cat <<HERE_DOC<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">NETWORKING=yes<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">HOSTNAME=$HOSTNAME<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">GATEWAY=$GATEWAY<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">HERE_DOC<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">exec 1<&6<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">```<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Works great with RHEL 5/6, but since RHEL 7 switched to systemd not so much (due to hostnamectl [a totally unnecessary change]). According to the documentation[1], I should only have to put my hostname in `/etc/hostname`. So I added this
to my post script:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">```<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">cat /etc/redhat-release 1>/dev/null | grep "release 7"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">if [ \$? -eq 0 ]; then<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"># RHEL 7<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">echo "Enabling RHEL 7 hostname"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">exec 6<&1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">exec > /etc/hostname<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">cat <<HERE_DOC<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">$HOSTNAME<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">HERE_DOC<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">exec 1<&6<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">fi<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">```<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The "Enabling RHEL 7 hostname" doesn't get written to the kickstart post log, and the hostname doesn't get written to `/etc/hostname`.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Does anyone have a method for doing this?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">[1] -- <a href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Migration_Planning_Guide/sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management.html#sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management-Hostname_Definition" target="_blank">https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Migration_Planning_Guide/sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management.html#sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management-Hostname_Definition</a><span style="color:#888888"><br clear="all">
<span class="hoenzb"><o:p></o:p></span></span></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span class="hoenzb"><span style="color:#888888">-- </span><o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#888888">James Sumners<br>
</span><a href="http://james.sumners.info/" target="_blank">http://james.sumners.info/</a><span style="color:#888888"> (technical profile)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="http://jrfom.com/" target="_blank">http://jrfom.com/</a><span style="color:#888888"> (personal site)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><a href="http://haplo.bandcamp.com/" target="_blank">http://haplo.bandcamp.com/</a><span style="color:#888888"> (band page)<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Ale mailing list</span><br><span><a href="mailto:Ale@ale.org">Ale@ale.org</a></span><br><span><a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a></span><br><span>See JOBS, ANNOUNCE and SCHOOLS lists at</span><br><span><a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a></span><br></div></blockquote></body></html>