Linux provisioning with Cobbler (Essentials)

Cobbler is a provisioning tool that glues different technologies in order to make easy to build up the components of an efficent provisioning server, perfect for mass or frequent deployment of RedHat/Centos/Fedora Linux systems.
It's done for RedHat based distributions even if it's supposed to work also for Suse and Debian.
It provides in an easy way:
- PXE server support
- DHCP server integration
- Kickstart server with templates  
- Easy yum repository management.
It's client, Koan, can install virtual machines or reinstall an existing metal system.

Basic setup                    
yum install cobbler                  

Logic is easy:                  
1- you add / import distributions from CD or network                  
2- you add profiles and subprofiles for different kind of installations and kickstart templates                  
3- you may create systems based on existing profiles (MAC or IP addesses can be defined)                  
4- you can add Yum repositories to use with profiles                  
5- cobbler does the rest                  

1 - Import (makes a local copy of files) a distribution CD or ISO to provision with Cobbler                    
mount -t auto -o loop /data/iso/CentOS-5.1-i386-bin-DVD.iso /mnt/                    
cobbler import --mirror=/mnt/ --name=Centos5.1-i386                    
umount /mnt                    
Alternatively add a distro specifying where to find kernel and inird files (less common option).                  
cobbler distro add --name=RedHat5 --kernel=/path/to/vmlinuz--initrd=/path/to/initrd.img                  
                  
2 - Cobbler makes 2 default profiles (normal and xen), you can add more profiles with a command like:                  
cobbler profile add --name=rhel5-base --distro=RHEL-5-i386            

3- You can  also create specific systems using defined profiles:                  
cobbler system add --name=mailserver --profile=rhel5-base                  
                  
4- Add repositories to manage with cobbler (you can automatically mirror them):                
cobbler repo add --name=Centos-5.1-i386-CENTOSPLUS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5.1/centosplus/i386/                 
To refresh the local mirror and recreate repodata  type or place in cron:                  
cobbler reposync
                  

5- To apply all the configurations (stored in /var/lib/cobbler ) type                
cobbler sync                
This updates files in:                  
/tftpboot  (accordind to templates in /etc/cobbler/pxe* )                
/etc/dhcpd.conf
  (if dhcp support active, according to /etc/cobbler/dhcp.template )                  
/var/www/cobbler (Visible via web, should not be touched, it's mantained and "cleaned" by Cobbler):  The whole content of imported distros is copied in /var/www/cobbler/ks_mirror.                  
External repositories file (see below) are copied in /var/www/cobbler/repo_mirror  , kickstart files are generated in /var/www/cobbler/kickstarts  and  /var/www/cobbler/kickstarts_sys                

Common commands                  
cobbler check (verifies if there are problems with current setup)                    
cobbler list (lists all the cobbler elements)                    
cobbler report (detailed list of elements)                    
cobbler sync (syncronizes the configuration to dhcp/pxe and data directories)                    
cobbler reposync (syncronizes the configured mirrors of external repositories)





Cobbler configuration                  
Configurations are in /var/lib/cobbler/settings              
Interesting parameters:                    
server: '<ip_server>' (the IP of Kickstart server, commonly the cobbler server)                  
next_server: '<ip_server>' (the IP of the PXE server, commonly the cobbler server)                  
syslog: '<ip_server>:<port>' (Ip and port of a syslog server where to send anaconda installation logs). Add this under the "kernel_options" section                  
manage_dhcp: 1 (default is "0". Activate it if you want to manage Dhcpd with cobbler. Edit, according to your needs, the template file /etc/cobbler/dhcp.template                  
snippetsdir: /var/lib/cobbler/snippets (Add here custom snippets for kickstart templates)              
xmlrpc_rw_enable: 1
(Default is 0. Activate it to enable Cobbler web interface: http://yourserver/cobbler/web/ . Note that in versions somehow older than Cobbler 0.8 it was http://yourserver/cobbler/webui/wui.html)                  

Repository management  for common distros.                  

Examples for Centos 5 i386                    
cobbler repo add --name=Centos-5.1-i386-CENTOSPLUS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5.1/centosplus/i386/ --priority=40 --createrepo-flags="-c cache"                  
cobbler repo add --name=Centos-5.1-i386-EXTRAS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5.1/extras/i386/ --priority=40 --createrepo-flags="-c cache"                  
cobbler repo add --name=Centos-5.1-i386-UPDATES --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5.1/updates/i386/ --priority=10 --createrepo-flags="-c cache"
                  

Examples for EPEL / RPMFOGE for Centos/RHEL 5 i386                    
cobbler repo add --name=EL-5.i386-EPEL
--mirror=http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/5/i386/ --priority=50 --createrepo-flags="-c cache"                  
cobbler repo add --name=EL-5.i386-RPMFORGE                           --mirror=http://apt.sw.be/redhat/el5/en/i386/dag/ --priority=90 --createrepo-flags="-c cache"
                  

Examples for Fedora 8 i386                    
cobbler repo add --name=Fedora-8-i386-LIVNA --mirror=http://livna-dl.reloumirrors.net/fedora/8/i386/ --priority=90 --createrepo-flags="-c cache"                  
cobbler repo add --name=Fedora-8-i386-UPDATES --mirror=http://mirrors.kernel.org/fedora/updates/8/i386/ --priority=10 --createrepo-flags="-c cache"                  
cobbler repo add --name=Fedora-8-i386-EVERYTHING --mirror=http://mirrors.kernel.org/fedora/releases/8/Everything/i386/os/ --priority=50 --createrepo-flags="-c cache"
                  

Client side usage                    
Koan is cobbler's client:                    
yum install koan                  
koan --server=192.168.0.42 --list-profiles
(lists available profiles on the Cobbler server)                  
koan --server=192.168.0.42 --list-systems
(lists available systems, if any)                  
koan --virt --server=192.168.0.42 --profile=RHEL5-i386  --virt-name=web01 (installs a virtual guest using the indicated profile)                  
koan --virt --server=192.168.0.42 --profile=RHEL5-i386  --virt-name=web01                  
--nogfx
(installs a virtual guest from a console without graphic support).                  

Note: Default cobbler installations set "cobbler"  as root password.

Privacy Policy