[ale] Set hostname in RHEL 7 kickstart?

James Sumners james.sumners at gmail.com
Thu Apr 30 16:45:42 EDT 2015


Nope. That didn't work.

I'm using Satellite 6 to build and serve the kickstart. So what I did is
remove my post "blunt instrument" script and added a new pre script:

```
network --activate --device=$IFDEVICE --bootproto=static --ip=$IPADDR \
--netmask=255.255.255.0 --gateway=$GATEWAY --nameserver $DNS1,$DNS2 \
--hostname=$HOSTNAME --onboot=yes
```

The result is that the network script didn't get created at all because the
"network" tool couldn't be found.

On the "Kickstart Details > Advanced Options" page I have "--bootproto
dhcp". I suppose that's replaceable since the kickstart should be retrieved
after it has already booted from the PXE image?

On Thu, Apr 30, 2015 at 4:16 PM, Brian Mathis <
brian.mathis+ale at betteradmin.com> wrote:

> Set the hostname by making a tmp file with the 'network' kickstart command
> in the %pre script like this:
>     echo "network --device=ens192 --hostname=${HOSTNAME}" >
> /tmp/ks-network-hostname
> then include that file in the kickstart commands section of the file like
> this:
>     %include /tmp/ks-network-hostname
>
> 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.
>
>
> ❧ Brian Mathis
> @orev
>
>
> On Thu, Apr 30, 2015 at 2:53 PM, James Sumners <james.sumners at gmail.com>
> wrote:
>
>> I have a post script to set network configurations that gets used in all
>> of my kickstarts:
>>
>> ```
>> exec 6<&1
>> exec > /etc/sysconfig/network
>> cat <<HERE_DOC
>> NETWORKING=yes
>> HOSTNAME=$HOSTNAME
>> GATEWAY=$GATEWAY
>> HERE_DOC
>> exec 1<&6
>> ```
>>
>> 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:
>>
>> ```
>> cat /etc/redhat-release 1>/dev/null | grep "release 7"
>> if [ \$? -eq 0 ]; then
>> # RHEL 7
>> echo "Enabling RHEL 7 hostname"
>> exec 6<&1
>> exec > /etc/hostname
>> cat <<HERE_DOC
>> $HOSTNAME
>> HERE_DOC
>> exec 1<&6
>> fi
>> ```
>>
>> The "Enabling RHEL 7 hostname" doesn't get written to the kickstart post
>> log, and the hostname doesn't get written to `/etc/hostname`.
>>
>> Does anyone have a method for doing this?
>>
>> [1] --
>> 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
>>
>> --
>> James Sumners
>> http://james.sumners.info/ (technical profile)
>> http://jrfom.com/ (personal site)
>> http://haplo.bandcamp.com/ (band page)
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>


-- 
James Sumners
http://james.sumners.info/ (technical profile)
http://jrfom.com/ (personal site)
http://haplo.bandcamp.com/ (band page)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20150430/8b4b1b5f/attachment.html>


More information about the Ale mailing list