[Spacewalk-list] PRE Section doesn't work at all KVM Guest
William H. ten Bensel
WHTENBEN at up.com
Tue Apr 12 01:16:34 UTC 2016
Hopefully this example will help. You should be able to configure your
hostname logic like the following:
We had to do the following with CentOS 7.2 and Oracle Linux 7.2, because
there is a bug with how the static --network line is being generated. (Bug
opened with support and they have confirmed).
Systems -> Kickstarts -> Profiles -> {profile} -> Kickstart Details ->
Advanced Options -> Custom Options:
%include /tmp/network.out
Systems -> Kickstarts -> Profiles -> {profile} -> Scripts:
Name: Static_BUG
$SNIPPET('spacewalk/1/72network_bug')
Pre-Script
Check template --> Do not forget this, or it will not work.
%pre --log /tmp/ks-pre.log.1
# BEGIN: network Snippet
# Issue with CentOS 7.2, not able to handle just network --bootproto
static
# Get the static information that was passed during anaconda.
cat /proc/cmdline > /tmp/cmdline.out
server_ip=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print $1}'|awk
-F":" '{print $1}'`
server_gw=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print $1}'|awk
-F":" '{print $3}'`
server_nm=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print $1}'|awk
-F":" '{print $4}'`
server_host=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'|awk -F":" '{print $5}'`
server_dns=`awk -F"nameserver=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'`
if [[ -n "$server_host" ]]; then
cat <<_EOF >/tmp/network.out
network --noipv6 --onboot=yes --bootproto static --ip=$server_ip
--netmask=$server_nm --gateway=$server_gw --nameserver=$server_dns
--hostname=$server_host --device=link --activate
_EOF
# Another snippet will handle hostname, /etc/hostname, /etc/hosts,
/etc/sysconfig/network, and/or
# /etc/sysconfig/network-scripts/ifcfg-* if it is not passed here.
# That script most come prior to Registration and Activation!!
else
cat <<_EOF >/tmp/network.out
network --noipv6 --onboot=yes --bootproto static --ip=$server_ip
--netmask=$server_nm --gateway=$server_gw --nameserver=$server_dns
--device=link --activate
_EOF
fi
# END: network Snippet
- Thanks and good luck
From: Konstantin Raskoshnyi <konrasko at gmail.com>
To: spacewalk-list at redhat.com
Date: 04/11/2016 07:42 PM
Subject: Re: [Spacewalk-list] PRE Section doesn't work at all KVM
Guest
Sent by: spacewalk-list-bounces at redhat.com
This email originated from outside of the company. Please use discretion
if opening attachments or clicking on links.
After installation there's no file pre_install_network_config in tmp
directory..
May be nochroot can help?
On Mon, Apr 11, 2016 at 5:13 PM, Colin Coe <colin.coe at gmail.com> wrote:
Are you including that file?
The following will need to be in your kickstart...
%include /tmp/pre_install_network_config
On Tue, Apr 12, 2016 at 8:03 AM, Konstantin Raskoshnyi <konrasko at gmail.com
> wrote:
Stuck on this problem - I wanted to set up hostname for KVM machine on
pre,
ok - I spent 3 days, but in fact ks ignore all pre sections...
also I found that Spacewalk trying to set hostname by itself, here the
text from anakonda.cfg
# Start of code to match cobbler system interfaces to physical interfaces
by their mac addresses
# Start eth0
# Configuring eth0 (00:16:3e:53:0e:0d)
if mac_exists 00:16:3e:53:0e:0d
then
get_ifname 00:16:3e:53:0e:0d
echo "network --device=$IFNAME --bootproto=dhcp --hostname=virttest001"
>> /tmp/pre_install_network_config
fi
But no logs, no errors, no other stuff. Also no my pre scripts in /tmp
directory
Any thoughts?
_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list
_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list
This email originated from outside of the company. Please use discretion
if opening attachments or clicking on links.
_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list
**
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20160411/5aa8e5a7/attachment.htm>
More information about the Spacewalk-list
mailing list