On Tue, Dec 30, 2008 at 06:34:32PM -0500, Michael DeHaan wrote:
> Axel Thimm wrote:
>
>> anaconda has an %include directive, but that only works for local
>> files. The usual trick is to %pre a wget and %include it later on. But
>> that doesn't work if the parent kickstart file is the one defining the
>> base parameters like which URL to install from etc.
>>
>> Also %including a prerendered kickstart file isn't really cobbler
>> style, the variables could have changed and the included rendered file
>> would reflect the old settings of the parent profile.
>>
>> As a workaround I'm doing the following on top of every kickstart file:
>>
>> #if $getVar("ksparent","") != ""
>> #include $ksparent
>> #end if
>>
>> But ksparent needs to be provided and I'm using the poor man's API as
>>
>> ksparent=`cobbler profile dumpvars --name=Parent | grep "^
'kickstart':" | sed -e"s| 'kickstart':
'\(.*\)',$|\1|"`
>> ...
>> cobbler profile add [...] --inherit=Parent
--ksmeta="ksparent=$ksparent" [...]
>>
>> It would be nice if ksparent could be set automatically by cobbler and
>> if a simple scriplet like
>> $ cat /var/lib/cobbler/snippets/include_parent
>> #if $getVar("ksparent","") != ""
>> #include $ksparent
>> #end if
>>
>> would be referenced on all sample kickstart files as
>>
>> $SNIPPET('include_parent')
>>
>> Thanks!
>>
> I'm not sure I understand this one -- could you explain a bit more about
> the use case and what you mean by "parent"/"ksparent" in this
case?
>
The use case are subprofiles, that's where $parent comes from.
If one defines a subprofile it is usually for a more specialized group
of hosts that may need a slightly different kickstart
file. Fortunately most kickstart options can be overriden by later
options and some sections are even merged together, so that
%include /some/kickstart/file/parent.ks
at the very top of the kickstart file inherits the parent kickstart
and extends it.
This is heavily utilized in the Fedora spins, see for example
https://fedorahosted.org/spin-kickstarts/browser/fedora-livecd-desktop.ks#L5
https://fedorahosted.org/spin-kickstarts/browser/fedora-live-base.ks
The use case in cobbler is more like
# cobbler list
distro f10-x86_64
profile f10-x86_64
profile desktop-f10-x86_64
system prospero
profile server-f10-x86_64
profile webserver-f10-x86_64
system shylock
For example webserver-f10-x86_64.ks could look like
$SNIPPET('include_parent')
%packages
@web-server
%end
------------------------------------------------------------------------
_______________________________________________
cobbler mailing list
cobbler(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler
Basically you can make a snippet called "foo" and then have
$SNIPPET('foo') do something else depending on the profile.
This would allow for what you want and still let the two to share a
common kickstart file.
--Michael