[Spacewalk-list] Contents, Vol 52, Issue 40 digest - 2 snippets?

Todd_Walters at unigroupinc.com Todd_Walters at unigroupinc.com
Thu Sep 27 16:19:39 UTC 2012


In reply to message two, i've tried many times but can't seem to get 
snippets working. I create snippet, then create post file and check 
template, and paste my snippet line in the post section. I have tried 
putting # end /#endraw in the post script around the snippet, in the 
snippet itself,etc.. but nothing seems to work. Can anyone provide better 
simple how to create snippet? The docs are really lacking/

Thanks,


Todd Walters
Sr System Software Programmer / Linux





spacewalk-list-request at redhat.com 
Sent by: spacewalk-list-bounces at redhat.com
09/27/2012 07:54 AM
Please respond to
spacewalk-list at redhat.com


To
spacewalk-list at redhat.com
cc

Subject
Spacewalk-list Digest, Vol 52, Issue 40






   2. Re: spacewalk 1.7 provisioning centos 6.3 (Jakl Stefan)


----------------------------------------------------------------------


------------------------------

Message: 2
Date: Thu, 27 Sep 2012 12:52:31 +0000
From: Jakl Stefan <Stefan.Jakl at wuerth-itensis.com>
To: "spacewalk-list at redhat.com" <spacewalk-list at redhat.com>
Subject: Re: [Spacewalk-list] spacewalk 1.7 provisioning centos 6.3
Message-ID:
 <352575FA8069D145AD304F906924A4D00269E513 at WITMAIL01.wit.local>
Content-Type: text/plain; charset="iso-8859-1"

Hi Thomas

I've got the same experiance. Heres my workarround:

In my case, I had to enter a proxy into yum.conf
SNIPPET-1:
%post
#raw

if [ -e /etc/yum.conf ]; then
                echo "proxy=http://1.1.1.1:8080" >> /etc/yum.conf
fi

#endraw

Then, I was able to use a "foreign" Spacewalk-Repo, again with a second 
SNIPPET:

%post
#raw

rpm --import http://spacewalk.local/pub/RPM-GPG-KEY-spacewalk-2012

rpm -ivh http:// spacewalk.local /pub/python-hwdata.el6.noarch.rpm

rpm -ivh http:// spacewalk.local /pub/spacewalk-client-repo.rpm

rpm -ivh http:// spacewalk.local 
/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm

yum install -y rhn-check.noarch rhn-setup.noarch rhncfg-client.noarch 
rhn-client-tools.noarch rhnsd rhncfg rhn-client-tools

#endraw




[Beschreibung: W?rth ITensis AG]

Stefan Jakl
Linux Engineer
Alte Winterthurerstrasse 14a
CH - 8304 Wallisellen
Telefon:
Fax:
E-Mail:
Webseite:

+41 44 913 93 26
+41 44 913 93 01
stefan.jakl at wuerth-itensis.com
www.wuerth-itensis.com



Von: spacewalk-list-bounces at redhat.com [
mailto:spacewalk-list-bounces at redhat.com] Im Auftrag von Lint Thomas
Gesendet: Montag, 24. September 2012 15:08
An: spacewalk-list at redhat.com
Betreff: [Spacewalk-list] spacewalk 1.7 provisioning centos 6.3

Hello,

while configuring spacewalk 1.7 on centos 6.3 a problem occurred at centos 
6.3 provisioning. I guess it is caused by the generated kickstart config 
and the ongoing installation procedure that relies on up2date which is not 
shipped with centos 6.3 anymore.

Setup:
Spacewalk Server
Centos 6.3 x64 minimal
Spacewalk 1.7 postgreSQL

We Configured Spacewalk 1.7 and created a Software Channel, added a Repo 
and created a kickstart profile which is published via http.
Our client machine initiates the installation over PXE-boot and retrieves 
the Centos6.3 base install image from cobbler. The automatic generated 
kickstart file does not work with centos 6.3 even though we selected the 
correct distribution.

Are there know issues/incompatibilities with centos 6.3? does anyone know 
when 6.3 will be fully supported or how to fix the described issue?

There the paste of the automatic generated spacewalk kickstart config:

# Kickstart config file generated by Spacewalk Config Management
# Profile Label : Centos6_x64-test
# Date Created  : Thu Sep 20 17:21:13 CEST 2012

install
text
network --bootproto dhcp
url --url http://spacewalk1.sec/ks/dist/centos6-x64
lang en_US
keyboard us
zerombr
clearpart --all
bootloader --location mbr
timezone America/New_York
auth --enablemd5 --enableshadow
rootpw --iscrypted $1$vtNOYEQs$2T/hfAVCjWc.BlBtroMlQ/
selinux --permissive
reboot
firewall --disabled
skipx
part /boot --fstype=ext3 --size=200
part pv.01 --size=1000 --grow
part swap --size=1000   --maxsize=2000
volgroup myvg pv.01
logvol / --vgname=myvg --name=rootvol --size=1000 --grow

%packages
%end

%pre

wget "
http://spacewalk1.sec/cblr/svc/op/trig/mode/pre/profile/Centos6_x64-test:1:SpacewalkDefaultOrganization
" -O /dev/null

echo "Saving RHN keys..." > /dev/ttyS0
SYSTEM_ID=/etc/sysconfig/rhn/systemid
rhn_keys_found=no

mkdir -p /tmp/rhn

drives=$(list-harddrives | awk '{print $1}')
for disk in $drives; do
    DISKS="$DISKS $(fdisk -l /dev/$disk | grep -v "swap\|LVM\|Extended" | 
awk '/^\/dev/{print $1}')"
done

# Try to find the keys on ordinary partitions
for disk in $DISKS; do
    name=test-$(basename $disk)
    mkdir -p /tmp/$name
    mount $disk /tmp/$name
    [ $? -eq 0 ] || continue # Skip to the next partition if the mount 
fails

    # Copy current RHN host keys out to be reused
    if [ -f /tmp/${name}$SYSTEM_ID ]; then
        cp -a /tmp/${name}$SYSTEM_ID /tmp/rhn
        rhn_keys_found="yes"
        umount /tmp/$name
        break
    fi
    umount /tmp/$name
    rm -r /tmp/$name
done

# Try LVM if that didn't work
if [ "$rhn_keys_found" = "no" ]; then
    lvm lvmdiskscan
    vgs=$(lvm vgs | tail -n +2 | awk '{ print $1 }')
    for vg in $vgs; do
        # Activate any VG we found
        lvm vgchange -ay $vg
    done

    lvs=$(lvm lvs | tail -n +2 | awk '{ print "/dev/" $2 "/" $1 }')
    for lv in $lvs; do
        tmpdir=$(mktemp -d findkeys.XXXXXX)
        mkdir -p /tmp/${tmpdir}
        mount $lv /tmp/${tmpdir} || continue # Skip to next volume if this 
fails

        # Let's see if the keys are in there
        if [ -f /tmp/${tmpdir}$SYSTEM_ID ]; then
            cp -a /tmp/${tmpdir}$SYSTEM_ID /tmp/rhn/
            rhn_keys_found="yes"
            umount /tmp/${tmpdir}
            break # We're done!
        fi
        umount /tmp/${tmpdir}
        rm -r /tmp/${tmpdir}
    done

    # And clean up..
    for vg in $vgs; do
        lvm vgchange -an $vg
    done
fi


%end

%post --nochroot
mkdir /mnt/sysimage/tmp/ks-tree-copy
if [ -d /oldtmp/ks-tree-shadow ]; then
cp -fa /oldtmp/ks-tree-shadow/* /mnt/sysimage/tmp/ks-tree-copy
elif [ -d /tmp/ks-tree-shadow ]; then
cp -fa /tmp/ks-tree-shadow/* /mnt/sysimage/tmp/ks-tree-copy
fi
cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
cp -f /tmp/ks-pre.log* /mnt/sysimage/root/ || :

%end

%post --nochroot --interpreter /usr/bin/python
try:
    import xmlrpclib
    import shutil
    import sys
    import os.path
    old_system_id = "/tmp/rhn/systemid"
    new_system_id = "/mnt/sysimage/root/systemid.old"

    new_keys = "1-f8fa019b2fc1d692d9dcad6ce2ddbf8e"
    for key in new_keys.split(','):
        if key.startswith('re-'):
            sys.exit(0)
    if os.path.exists(old_system_id):
        client =  xmlrpclib.Server("http://spacewalk1.sec/rpc/api")
        key = 
client.system.obtain_reactivation_key(open(old_system_id).read())
        f = open("/mnt/sysimage/tmp/key","w")
        f.write(key)
        f.close()
        shutil.copy(old_system_id, new_system_id)
except:
    # xml rpc due to  a old/bad system id
    # we don't care about those
    # we'll register those as new.
    pass


%end

%post --log /root/ks-rhn-post.log


# --Begin Spacewalk command section--
cat > /tmp/ssl-key-1 <<'EOF'
## <certificate removed by author>

EOF
# ssl-key1
cat /tmp/ssl-key-* > /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
perl -pe 's/RHNS-CA-CERT/RHN-ORG-TRUSTED-SSL-CERT/g' -i 
/etc/sysconfig/rhn/up2date

mkdir -p /tmp/rhn_rpms/optional
cd /tmp/rhn_rpms/optional
wget -P /tmp/rhn_rpms/optional 
http://spacewalk1.sec/download/package/ecc93e74e509e28e0866753fa36ce6a469d2c3f9/0/1/5705/pyOpenSSL-0.10-2.el6.x86_64.rpm 
http://spacewalk1.sec/download/package/67b0f77afcf12ec0e87c1dc501192699d5d5d27c/0/1/6295/rhnlib-2.5.51-1.el6.noarch.rpm 
http://spacewalk1.sec/download/package/52b9915e3a5adedb4420cbdcf37f3f33c733058a/0/1/6014/libxml2-python-2.7.6-4.el6_2.4.x86_64.rpm

rpm -Uvh --replacepkgs --replacefiles /tmp/rhn_rpms/optional/pyOpenSSL* 
/tmp/rhn_rpms/optional/rhnlib* /tmp/rhn_rpms/optional/libxml2-python*
perl -npe 
's|^(\s*(noSSLS\|s)erverURL\s*=\s*[^:]+://)[^/]*/|${1}spacewalk1.sec/|' -i 
/etc/sysconfig/rhn/up2date

# now copy from the ks-tree we saved in the non-chroot checkout
cp -fav /tmp/ks-tree-copy/* /
rm -Rf /tmp/ks-tree-copy
# --End Spacewalk command section--

# begin cobbler snippet
# set default MOTD
echo "Kickstarted on $(date +'%Y-%m-%d')" >> /etc/motd

# begin Red Hat management server registration
mkdir -p /usr/share/rhn/
wget http://spacewalk1.sec/pub/RHN-ORG-TRUSTED-SSL-CERT -O 
/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
perl -npe 's/RHNS-CA-CERT/RHN-ORG-TRUSTED-SSL-CERT/g' -i 
/etc/sysconfig/rhn/*
key=""
if [ -f /tmp/key ]; then
    key=`cat /tmp/key`
fi

if [ $key ]; then
    rhnreg_ks --serverUrl=https://spacewalk1.sec/XMLRPC 
--sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT 
--activationkey=$key,1-f8fa019b2fc1d692d9dcad6ce2ddbf8e
else
     rhnreg_ks --serverUrl=https://spacewalk1.sec/XMLRPC 
--sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT 
--activationkey=1-f8fa019b2fc1d692d9dcad6ce2ddbf8e
fi
# end Red Hat management server registration

# end cobbler snippet

rhn_check

# Start post_install_network_config generated code
# End post_install_network_config generated code

%end


%post


# Start koan environment setup
echo "export COBBLER_SERVER=spacewalk1.sec" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER spacewalk1.sec" > /etc/profile.d/cobbler.csh
# End koan environment setup



wget "
http://spacewalk1.sec/cblr/svc/op/ks/profile/Centos6_x64-test:1:SpacewalkDefaultOrganization
" -O /root/cobbler.ks
wget "
http://spacewalk1.sec/cblr/svc/op/trig/mode/post/profile/Centos6_x64-test:1:SpacewalkDefaultOrganization
" -O /dev/null
%end



*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://www.redhat.com/archives/spacewalk-list/attachments/20120927/55fba2d5/attachment.html
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 1865 bytes
Desc: image001.gif
URL: <
https://www.redhat.com/archives/spacewalk-list/attachments/20120927/55fba2d5/attachment.gif
>

------------------------------

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list

End of Spacewalk-list Digest, Vol 52, Issue 40
**********************************************


######################################################################## 
The information contained in this message, and any attachments thereto, 
is intended solely for the use of the addressee(s) and may contain 
confidential and/or privileged material.  Any review, retransmission, 
dissemination, copying, or other use of the transmitted information is 
prohibited.  If you received this in error, please contact the sender 
and delete the material from any computer.  UNIGROUPINC.COM 
########################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20120927/0098aadf/attachment.htm>


More information about the Spacewalk-list mailing list