[Spacewalk-list] cobbler integration with kickstart variables

Dallas Graves dallasg79 at gmail.com
Sun Sep 7 15:12:22 UTC 2014


Thanks Jonathan, your suggestion to investigate Cheetah further was exactly
what I was missing.  I've been able to throw in some Python code into my
kickstart file and by passing some variables into Cobbler via the --ksmeta
switch, I've been able to achieve my goal of using a single default
Kickstart profile to apply to all hosts in my environment.  In case anyone
is curious, here's what my solution looks like in practice.

Kickstart variables with the required python code for the Cheetah
templating:
#set $ip_address=$getVar'ip_address'
#set $netmask=$getVar'netmask'
#set $gateway=$getVar'gateway'
#set $hostname=$getVar'hostname'
#set $name_servers=$getVar'name_servers'

...then setting the variables in the 'network' section in the Kickstart
file:
network --noipv6 --onboot=yes --hostname=$hostname --bootproto=static
--ip=$ip_address --netmask=$netmask --gateway=$gateway
--nameserver=$name_servers

And the Cobbler deployment would look like this:
cobbler system add --name=test1.home.local --mac-address=52:54:00:55:a4:99
--profile=centos7_base:1:SpacewalkDefaultOrganization
--ksmeta="hostname=test1.home.local ip_address=192.168.1.99
netmask=255.255.255.0 gateway=192.168.1.1 name_servers=192.168.1.31"

Thanks,
-Dallas Graves



On Sat, Sep 6, 2014 at 11:58 AM, Jonathan Hoser <
jonathan.hoser at helmholtz-muenchen.de> wrote:

>  Hi Dallas,
>
> You might want to look at the cheetah template how-tos;
> e.g. if you set some variable in cobbler - like say (extracted from
> system-report)
>
> Kickstart Metadata             : {'isOldIBM': 'true'}
>
> You could use that in the Spacewalk-Kickstart as follows:
>
> #set $isOldIBM = $getVar('isOldIBM', 'false')
> #if $isOldIBM == 'true'
>
> cat somefile > somewhere
> do some other stuff
>
> #else
>
> do something else
>
> #end if
>
> -------------------------
> Important to note, is that commands are immedialy after the sharp '#'
> (#set, #if, #else, #end if)
> otherwise the templating system does not get them.
> The remainder should be obvious!
>
> Best
> -Jonathan
>
>
> On 09/06/2014 05:46 PM, Dallas Graves wrote:
>
>  Hi All,
> This may be more of a "Cobbler" question, but still relevant to Spacewalk
> in how I am trying to utilize the platform.  And please excuse me if this
> has already been answered in another post, I've been searching the web for
> a couple days now and haven't found any leads so I figured I'd join the DL
> and post here.
>
>  I'm curious if there is a more efficient way to utilize kickstart
> variables in conjunction with Cobbler?  Essentially, I'd like to have
> Kickstart use the variables I've set in the Cobbler System Profile, such as
> hostname, ip-address, etc... and use those as variables for the same in the
> Kickstart script.
>
>  My end goal is to have a single kickstart file to maintain instead of
> manually updating the variables each time I kickstart a machine, or even
> worse, each system having it's own KS file.
>
>  Thanks,
>   -Dallas Graves
>
>
>
> --
> Jonathan Hoser, M.Sc.
> Institute of Bioinformatics and System Biology
> WWW: http://mips.helmholtz-muenchen.de
>
>
> ------------------------------
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons
> Enhsen
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20140907/75235c66/attachment.htm>


More information about the Spacewalk-list mailing list