Cobbler & libvirt-remote
by Michael DeHaan
One of the recent developments in libvirt (RHEL 5.1 and later, Fedora 8
and later) is "libvirt remote" which allows for doing installs remotely
without helper tools, if the right libraries are already preinstalled.
Some details here: http://libvirt.org/remote.html
I can see this being incorporated in cobbler as follows:
cobbler system vivify --name=foosball --on-host=host1.example.org
cobbler profile vivify --name=airhockey --on-host=host2.example.com
This would contact the remote system using libvirt-remote (probably over
SSH) and install the guest right from the cobbler command line, without
having to SSH in to the other system to run koan (or install koan, if
required).
Older RHEL/Fedora guests should still need koan, and koan would not be
going away. For instance, koan is useful for actions that are
initiated by users who are not in control of the cobbler server -- such
developers installing profiles -- it serves an important purpose.
Thoughts or improvements on the above proposal?
I'll probably begin exploring this relatively soon. It seems to be a
useful feature and relatively low impact in that it would not have to
impact to many other areas of cobbler. Cobbler would of course not
import libvirt unless this feature was being used, to prevent
RPM-dependency-bloat on hosts such as RHEL 4 (as Cobbler is supported
there).
--Michael.
15 years, 9 months
Assigning default profiles to PXE based on subnets
by Michael DeHaan
Cobbler has been able to do this for a long time:
cobbler system add --name=default --profile=p1
This makes every system that does not have an explicit IP or MAC based
assignment PXE to profile "p1".
However, what happens if you want to do this on a subnet by subnet
basis? PXE lets you do this, but until now (1.1 devel branch) cobbler
didn't have a way to represent this.
How does it work?
cobbler system add --name=asdf --profile=p1 --ip=192.168.200.0/24
This makes any system with an IP that comes up in the 192.168.200.XXX
block get the profile in question.
(Note that these "magic" system records should not do anything to
DHCP/DNS management and I will be adding code to keep those entries from
being added... later when we have "network" objects in Cobbler, we can
use those objects to implement that feature and will be able to assign a
default profile to a specific network)
Thanks to John Eckersberg for help with this feature.
--Michael
15 years, 9 months
cobbler and cfengine
by Chris O'Regan
Does anyone have detailed documentation regarding how to set up cfengine
with cobbler? I am trying to resolve the chicken-and-egg problem with
respect to key exchange. Much of what I am finding glosses over the
details...
Thanks,
Chris
15 years, 9 months
diskless provisioning
by Shuichi Ihara
Hi,
I'm attempting to integrate the diskless provisioning feature into the cobbler
as the diskless client management on the cobbler. As the diskless provisioning
tool, we are now using the oneSIS (http://onesis.org/).
So, I have created a couple of patches to collaborate with oneSIS and Cobbler
as work cobbler's sub-command.
If you are interested in this functions, please test an attached patch (see
how-to-use.txt) and any feedbacks are welcome to me. Also, any comments
would be appreciated.
Thanks
-Ihara
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
#
# ******************************************************************
ddns-update-style none;
use-host-decl-names on;
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
#if $omapi_enabled
omapi-port $omapi_port;
#end if
site-option-space "pxelinux";
option pxelinux.magic f1:00:74:7e;
if exists dhcp-parameter-request-list {
option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
}
option pxelinux.reboottime 30;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
use-host-decl-names true;
option vendor-encapsulated-options 3c:09:45:74:68:65:72:62:6f:6f:74:ff;
filename "pxelinux.0";
next-server $next_server;
option root-path "192.168.1.1:/var/lib/oneSIS/image/centos-5.1,v3,tcp,hard";
}
$insert_cobbler_system_definitions
Assumption : The distribution is Centos-5.1
1. Download and install onesis with rpm (http://onesis.org/)
2. Apply onesis.patch to cobbler-1.0.3 and build again
3. Download attached "sysimage.conf" (onesis configuration template) and "dhcp.template.onesis" to your server
4. create diskless's rootFS
# cobbler onesis --rootfs=/var/lib/oneSIS/image/centos-5.1 \
--conf=/tmp/sysimage.conf
this means that rootFS copies to /var/lib/oneSIS/image/centos-5.1 for diskless client's rootFS
(NOTE: if your rootFS is too big, copy time will be too long and your disk might be full. The "copy-rootfs" in oneSIS has "--exclude" option that can be pointed no-copied directory, but it's not used in added the patch, sorry)
5. Modify dhcp.template
# cd /etc/cobbler
# cp dhcp.template dhcp.template.orig
# cp /path/to/dhcp.template.onesis dhcp.template
# vi dhcp.template
modify dhcp.template as your network environment
# cobbler sync
# /etc/init.d/dhcpd start
6. Adding the distribution
# cobbler distro add --name=onesis_centos-5.1 --kernel=/boot/vmlinuz-`uname -r` \
--initrd=/tftpboot/initrd-`uname -r`.img
7. Adding the profile
# cobbler profile add --name=onesis_client --distro=onesis_centos-5.1
8. Adding the system
# cobbler system add --name=st409 --mac=00:09:3d:00:b0:46 --ip=10.173.7.8 --hostname=st409 \
--profile=onesis_client --kopts="console=ttyS0,9600 selinux=0 root=/dev/nfs"
(NOTE: please change "name", "hostname", "mac", "ip" and "kopts" as your environment)
9. Restart DHCP and NFS service
# cobbler sync
# /etc/init.d/dhcpd restart
# /etc/init.d/nfs restart
10. Boot the client with PXE
The client will boot up as the diskless client
diff -Nur cobbler-1.0.3.orig/cobbler/action_onesis.py cobbler-1.0.3/cobbler/action_onesis.py
--- cobbler-1.0.3.orig/cobbler/action_onesis.py 1969-12-31 19:00:00.000000000 -0500
+++ cobbler-1.0.3/cobbler/action_onesis.py 2008-07-22 04:08:46.000000000 -0400
@@ -0,0 +1,72 @@
+"""
+Supports OneSIS commands as an cobbler sub command.
+
+Copyright 2008, Sun Microsystems, Inc
+Shuichi Ihara <ihara(a)sun.com>
+
+This software may be freely redistributed under the terms of the GNU
+general public license.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import os
+import re
+import sub_process
+from utils import _
+import utils
+
+class OneSIS:
+
+ def __init__(self,config):
+ """
+ Constructor
+ """
+ self.config = config
+ self.settings = config.settings()
+
+ def run(self,rootfs=None,kernelversion=None,nocopy=True,configfile=None):
+
+ if not os.path.exists("/sbin/copy-rootfs"):
+ print _("oneSIS is not installed, please install oneSIS")
+ return False
+
+ if kernelversion is None:
+ kernelversion = os.popen("uname -r").read()
+ kernelversion = kernelversion.rstrip()
+
+ if not os.path.exists(rootfs):
+ os.system("mkdir -p %s" % rootfs)
+ else:
+ print "%s is existing, the directory must be removed" % rootfs
+ return False
+
+ rc = os.system("/sbin/copy-rootfs -l %s" % rootfs)
+ if rc != 0:
+ return False
+
+ rc = os.system("chroot %s /sbin/mk-initramfs-oneSIS -f -s 8192 -w e1000 -w forcedeth /root/initrd-%s.img %s" % (rootfs, kernelversion, kernelversion))
+
+ if rc != 0:
+ return False
+
+ utils.copyfile("%s/root/initrd-%s.img" % (rootfs,kernelversion), "/tftpboot/initrd-%s.img" % kernelversion)
+
+ f = open('/etc/exports','a+')
+ nfsflag=1
+ for line in f.readlines():
+ if re.search(rootfs, line):
+ nfsflag=0
+
+ if nfsflag != 0:
+ f.write("%s *(ro,no_root_squash,sync)\n" % rootfs)
+ f.close()
+
+ utils.copyfile(configfile, "%s/etc/sysimage.conf" % rootfs)
+ rc = os.system("/sbin/mk-sysimage %s" % rootfs)
+ if rc != 0:
+ return False
+
+ return True
diff -Nur cobbler-1.0.3.orig/cobbler/api.py cobbler-1.0.3/cobbler/api.py
--- cobbler-1.0.3.orig/cobbler/api.py 2008-07-03 16:52:52.000000000 -0400
+++ cobbler-1.0.3/cobbler/api.py 2008-07-22 01:24:41.000000000 -0400
@@ -24,6 +24,7 @@
import action_validate
import action_buildiso
import action_replicate
+import action_onesis
from cexceptions import *
import sub_process
import module_loader
@@ -432,6 +433,15 @@
replicator = action_replicate.Replicate(self._config)
return replicator.run(cobbler_master = cobbler_master)
+ def onesis(self,rootfs=None,kernelversion=None,nocopy=True,configfile=None):
+ onesiser = action_onesis.OneSIS(self._config)
+ return onesiser.run(
+ rootfs=rootfs,
+ kernelversion=kernelversion,
+ nocopy=nocopy,
+ configfile=configfile
+ )
+
def get_kickstart_templates(self):
return utils.get_kickstar_templates(self)
diff -Nur cobbler-1.0.3.orig/cobbler/modules/cli_misc.py cobbler-1.0.3/cobbler/modules/cli_misc.py
--- cobbler-1.0.3.orig/cobbler/modules/cli_misc.py 2008-07-03 16:30:59.000000000 -0400
+++ cobbler-1.0.3/cobbler/modules/cli_misc.py 2008-07-22 01:17:48.000000000 -0400
@@ -277,6 +277,37 @@
def run(self):
return self.api.replicate(cobbler_master = self.options.master)
+########################################################
+
+class OneSISFunction(commands.CobblerFunction):
+
+ def add_options(self,p,args):
+ p.add_option("--rootfs", dest="rootdir", help="root directory for diskless client")
+ p.add_option("--kernel-version", dest="kernel_version", help="kernel version of diskless client")
+ p.add_option("--no-copy-rootfs", action="store_true", dest="nocopy", help="no copy installed distribution to client's rootfs")
+ p.add_option("--conf", dest="configfile", help="oneSIS configuration file")
+
+ def help_me(self):
+ return HELP_FORMAT % ("cobbler onesis","[ARGS|--help]")
+
+ def command_name(self):
+ return "onesis"
+
+ def run(self):
+ if not self.options.rootdir:
+ self.options.nocopy=False
+ raise CX(_("rootfs is required"))
+
+ if not self.options.configfile:
+ self.options.nocopy=False
+ raise CX(_("configfile is required"))
+
+ return self.api.onesis(
+ rootfs=self.options.rootdir,
+ kernelversion=self.options.kernel_version,
+ nocopy=self.options.nocopy,
+ configfile=self.options.configfile
+ )
########################################################
@@ -294,7 +325,7 @@
CheckFunction(api), ImportFunction(api), ReserializeFunction(api),
ListFunction(api), ReportFunction(api), StatusFunction(api),
SyncFunction(api), RepoSyncFunction(api), ValidateKsFunction(api),
- ReplicateFunction(api)
+ ReplicateFunction(api), OneSISFunction(api)
]
return []
####-----------------------------------------------------------------------####
# example oneSIS configuration file.
#
# This config is more complex than the typical setup.
# It is trying to show an example of how to use each type of directive.
#
# For more information on configuration directives/syntax, refer to the
# oneSIS Administrator's manual: http://onesis.sourceforge.net/docs.html
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# DISTRO: <name> <version> #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# INCLUDE: <path> #
DISTRO: redhat-el as5
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# NODECLASS_REGEXP: <perl_regexp> <CLASS> #
# NODECLASS_MAP: <NODE> <CLASS> #
# NODECLASS_RANGE: <prefix[RANGE]...suffix> <CLASS> #
# RANGE can be of the form [a-b,x-y,...], where a<b and x<y #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# PROPERTY: <propname> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-r RANGE] [-re REGEXP] #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# SERVICE: <name> -c CLASS[,CLASS]... -n NODE[,NODE]... #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# RAMSIZE: <max_size [k|m|g]> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
RAMSIZE 10m
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# RAMDIR: <dir> [-d] [-p] [-m mode] [-u user] [-g group] #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# RAMFILE: <file> [-d] [-m mode] [-u user] [-g group] #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# LINKDIR: <dir> [-d] [-p] [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# LINKFILE: <file> [-d] [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
LINKDIR /var/run -d
LINKDIR /var/log -d
LINKDIR /var/lock/subsys
LINKDIR /var/empty/sshd -d
LINKDIR /var/lock/irqbalance
LINKDIR /tmp
LINKFILE: /etc/infiniband/openib.conf -d
#LINKFILE: /etc/reader.conf -d
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# LINKBACK: <file|dir> [*] <'CLASS'|'NODE'|target> [-h] #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# DISKMOUNT: <disk> <size[%]> <mointpoint> #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# DISKSWAP: <disk> <size[%]> #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# DEPLOYMOUNT: <disk> <size[%]> <mointpoint> #
# [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# DEPLOYSWAP: <disk> <size[%]> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# BOOTLOADER: <grub | lilo> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# SYNCDIR: <path> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
# EXCLUDESYNC: <path> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# ETH_PRELOAD: <driver,[driver]...> #
# MAC_ADDR: <hostname> <mac_address> #
####-----------------------------------------------------------------------####
####-----------------------------------------------------------------------####
# CONSOLECMD: [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] <command> #
# POWERCMD: <function> [-c CLASS[,CLASS]...] [-n NODE[,NODE]...] #
# [-p PROPERTY[,PROPERTY]...] <command> #
# function can be: ON,OFF,CYCLE,STATUS,LEDON,LEDOFF,LEDSTATUS #
# SPECFORMAT: <spec_id> <format> [HOST:/// | IP:///] [SPEC:///] #
# format can be: hostname,ipaddr,basic_range,ext_range #
####-----------------------------------------------------------------------####
15 years, 9 months
Odd dependencies appearing when using $yum_repo_stanza
by Chris O'Regan
This is not really a Cobbler issue, but I am hoping someone here has run
into this.
I have set up a RHEL5 repository built with mrepo and I have added it to
my cobbler configuration. My kickstart file includes $yum_repo_stanza,
and I can see by the syslog output that my repos are being added to the
config. I start the install and the final package list is generated, but
for some reason, firefox is added, but it fails to install due to a
conflict:
error running transaction: file /etc/gre.d/gre64.conf from install of
xulrunner-1.9.0.1-1.el5 conflicts with file from package
firefox-1.5.0.12-3.el5
If I comment out the $yum_repo_stanza then firefox is not added to the
profile and the system installs without a hitch. The problem seems to
arise when kickstart uses packages from my repo instead of the
installation ISO image.
What is weird, though, is that I have live systems with essentially the
same profile as the server I am trying to build however firefox is *not*
installed there. Firefox is being added during kickstart because of this
supposed dependency:
adding firefox for libxpcom.so()(64bit), required by yelp
(libxpcom.so belongs to xulrunner)
I have a updates pending on my other systems including xulrunner however
firefox is not a dependency. I have not yet tried to update the new
server, but I am not expecting any problems. I kickstarted it this
morning with its original kickstart config (same package sets) and it
was updated with the latest packages in the repo.
Possible reasons:
1) Missing comps.xml files in my RHEL5 repos (have not had a chance to
fix this yet), or
2) mrepo is only keeping the latest version of each package; I have the
latest firefox-3.0.* in my repo but the only firefox-1.5.* is on the ISO
image.
Any other ideas? It would certainly cut installation time if kickstart
can select the latest RPMs rather than having to run an update post install.
Thanks,
Chris
15 years, 9 months
"So what the heck does /etc/cobbler/modules.conf do?"
by Michael DeHaan
In 1.0, we finally added nice comments explaining what everything in
/etc/cobbler/settings did. For 1.1(devel)/1.2, I've finally done the
same for /etc/cobbler/modules.conf.
Even if you aren't tracking the devel branch, this should still be
interesting as the config file settings are exactly the same between the
two versions. It lists all the module choices for each config
setting, which ones do what, and some pointers to further documentation
up on the Wiki.
You can take an advance look at this info here:
http://git.fedorahosted.org/git/?p=cobbler;a=blob_plain;f=config/modules....
--Michael
15 years, 9 months
cobbler 1.0.2-1: "cobbler validateks" finding errors, but exiting w/ success
by Charles Duffy
[root@cobbler ~]# cobbler validateks
...<snipped a great deal of output here>...
The following problem occurred on line 31 of the kickstart file:
Unknown command: Fault:
The following problem occurred on line 33 of the kickstart file:
Unknown command: </pre>
*** all kickstarts seem to be ok ***
[root@cobbler ~]# echo $?
0
15 years, 9 months
1.1 feature: cobbler find supports wildcards / neat xargs tricks
by Michael DeHaan
The "cobbler find" command is useful for a variety of purposes. For
instance, what kickstart uses this kickstart template?
cobbler profile find --kickstart=/etc/cobbler/sample.ks
And it will show all the profiles that use that template (if any)
The one thing we couldn't do before is do wildcard search. Now we can.
All systems containing the string foo:
cobbler system find --name="foo*"
This is rather useful when combined with xargs. This is a rather tame
example:
cobbler system find --name="TEST*" | xargs -n1 --replace cobbler system
report --name={}
By extension, you could use this to toggle the --netboot-enabled systems
of machines with certain hostnames, mac addresses, and so forth, or
perform other kinds of wholesale edits (for instance, deletes, or
assigning profiles with certain names to new distros when upgrading them
from F8 to F9, for instance).
I'll include info on this on the Wiki.
--Michael
15 years, 9 months