My Wiki!

Cobbler a Vagrant alternative

Kickstart files can be kept on a single server system and read by individual computers during the installation. This installation method can support the use of a single kickstart file to install Red Hat Enterprise Linux on multiple machines.

Install an Configuration Cobbler

The following are potential configuration items that you may want to fix:

1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
    https://github.com/cobbler/cobbler/wiki/Selinux
4 : missing /etc/xinetd.d/tftp, install tftp-server?
5 : missing configuration file: /etc/xinetd.d/tftp
6 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
7 : file /etc/xinetd.d/rsync does not exist
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
9 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one

Create Instance

Prepare Repos

  mount -o loop Fedora-18-x86_64-DVD.iso /mnt
  cobbler import --path=/mnt --name=fedora18 –arch=x86_64
  cobbler repo add --name fedora20-everything-x86_64 --mirror=http://mirror2.hs-esslingen.de/fedora/linux/releases/20/Everything/x86_64/os --mirror-locally=N
  ...
  cobbler reposync
  
  cobbler profile add --name=fedora20-x86_64-kvm_qcow2 \
  --distro=Fedora-20-x86_64 \
  --virt-disk-driver=qcow2 \
  --virt-type=kvm \
  --virt-path=/mnt/nfv/cobbler_ws/instances/
  
  cobbler system add --name=fedora20-x86_64-java_dev \
  --profile=fedora20-x86_64-kvm_qcow2 \
  --virt-ram=4096 \
  --firt-file-size=300 \
  --virt-cpus=2
  koan ...
  
  cobbler system edit --name=fedora20-x86_64-java_dev \
  --virt-bridge=kvmbr0 \
  --interface=eth0 \
      

1. Troubleshooting

1.1 cobbler command

[root@compass-cobbler /]# view /var/lib/tftpboot/pxelinux.cfg/01-00-00-c6-eb-f3-37 
[root@compass-cobbler /]# view /var/lib/tftpboot/pxelinux.cfg/01-00-00-c6-eb-f3-37 
[root@compass-cobbler /]# view /var/lib/tftpboot/pxelinux.cfg/                     
01-00-00-7c-40-15-46  01-00-00-c6-eb-f3-37  default               
[root@compass-cobbler /]# view /var/lib/tftpboot/pxelinux.cfg/default 
[root@compass-cobbler /]# view /var/lib/tftpboot/                     
boot/         etc/          grub/         images/       images2/      memdisk       menu.c32      ppc/          pxelinux.0    pxelinux.cfg/ s390x/        
[root@compass-cobbler /]# cobbler system list        
   host1
   host2
[root@compass-cobbler /]# cobber system --help
bash: cobber: command not found
[root@compass-cobbler /]# man cobbler
bash: man: command not found
[root@compass-cobbler /]# man cobbler
bash: man: command not found
[root@compass-cobbler /]# cobbler system --help                                                                                                                                                                                   
usage
=====
cobbler system add
cobbler system copy
cobbler system dumpvars
cobbler system edit
cobbler system find
cobbler system getks
cobbler system list
cobbler system poweroff
cobbler system poweron
cobbler system powerstatus
cobbler system reboot
cobbler system remove
cobbler system rename
cobbler system report
[root@compass-cobbler /]# cobbler system dumpvars host1
--name is required
[root@compass-cobbler /]# cobbler system dumpvars --name host1    

Installation status

  [root@compass-cobbler /]# cobbler status
  ip             |target              |start            |state            
  10.1.0.4       |system:host1        |Sat Dec 29 07:24:37 2018|installing (71m 11s)
  10.1.0.5       |system:host2        |Fri Dec 28 20:05:58 2018|finished         
parnurzeal, cobbler status working mechanism is very simple: a pre-install trigger (cobbler.modules.install_pre_log Python module) and a post-install trigger (cobbler.modules.install_post_log Python module) write to '/var/log/cobbler/install.log' when OS installation begins and ends. cobbler status simply uses the content of this file to generate output. The post-install trigger is started when http://<cobbler_server>/cblr/svc/op/trig/mode/post/system/<system_name> URL is called by the system being provisioned. This URL call in turn exists in kickstart_done snippet, which should be included by all kickstart templates.

The timestamps for start / end in /var/log/cobbler/install.log are Unix timestamps. To read them:

[root@compass-cobbler /]# view /var/log/cobbler/install.log 

system  host1   10.1.0.4        start   1546027549.45
system  host2   10.1.0.5        start   1546027558.08
system  host1   10.1.0.4        start   1546040614.42
system  host1   10.1.0.4        start   1546043133.58
system  host2   10.1.0.5        stop    1546053911.56
system  host1   10.1.0.4        start   1546068277.18

pyhton
>>> import datetime
>>> timestamp = 1546053911.56
>>> ts = int("1546053911")
>>> print(datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
2018-12-29 04:25:11
>>> ts = int("1546027558")
>>> print(datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
2018-12-28 21:05:58

--> 7 hours installation! with qemu

Navigation