Cobbler (https://fedorahosted.org/cobbler/) is an install server. Especially now that we are introducing virtual machines into gnome.org, it's important to be able to specify how a machine is installed and recreate that installation from scratch. Cobbler handles managing the installation sources and providing kickstart files.

GNOME Specifics

Our cobbler installation is hosted on combobox.gnome.org.

Installing a new system

Create a Cobbler configuration. It should be named with the name of the system (without the gnome.org). You would normally do this by copying one of the existing configurations.

cobbler system copy --name=<existing> --newname=<name>

Look at the configuration using:

cobbler system report <name>

And fix all the IP address references:

cobbler system edit --name=<name> --kopts='console=tty0,115200 ip=<private_ip>' --ksmeta="private_ip=<private_ip> public_ip=<public_ip>"
cobbler system edit --name=<name> --interface eth0 --ip-address=<public_ip>
cobbler system edit --name=<name> --interface eth1 --ip-address=<private_ip>

You may also want to adjust virt_ram (how much ram to give to the system, in megabytes), virt_cpus (the maximum number of CPUs the system is ever given), and -virt-file-size (size of system image in Gigabytes).

cobbler system edit --name=<name> --virt-ram=2048 --virt-cpus=4 --virt-file-size=10

Note that the bigger the memory is, the more of the system partition will be used for swap. Check again with 'cobbler system report' to make sure everything is as desired.

Disk/s setup

Cobbler allows you to specify whether you want a single or double disk for your virtual machine, you can specify this information this way:

cobbler system edit --name=<name> --virt-path=VolGroup00,VolGroup00
cobbler system edit --name=<name> --virt-file-size=15,100

These commands will automatically create two logical volumes both on the VolGroup00 VG with a size of 15G and 100G each. Make sure to use to the rhel7-guest-double-disk.ks kickstart file as it will automatically format and partition the logical volumes koan will create when invoked on the target machine:

cobbler system edit --name=<name> --kickstart=/var/lib/cobbler/kickstarts/rhel7-guest-double-disk.ks

If the machine will have one disk instead use the rhel7-guest-single-disk.ks instead:

cobbler system edit --name=<name> --kickstart=/var/lib/cobbler/kickstarts/rhel7-guest-single-disk.ks

What's next?

Before running koan make sure the following items are completed:

  1. Create a node file for the new host
  2. Add a motd file under puppet/modules/motd/templates/system

  3. Add the host on FreeIPA and include the keytab file on the certificates Git repository under the keytabs directory.

3. can be achieved with the following commands:

kinit admin@GNOME.ORG
ipa host-add --force --ip-address=<private_ip> <name>.gnome.org
ipa-getkeytab -s account.gnome.org -p host/<name>.gnome.org -k /root/keytabs/<name>.gnome.org.keytab
ssh puppet-back
git clone /git/certificates.git
mv /root/keytabs/<name>.gnome.org.keytab ~/certificates/keytabs
git add ~/certificates/keytabs/<name>.gnome.org.keytab
git commit -a -m 'Add the keytab file for <name>.gnome.org'
git push

Once the Cobbler system profile is ready and the above checklist is accomplished install the virtual machine by running the following command on the target host:

koan --server=combobox-back --virt --virt-name=<name> --system=<name>

The Kickstart takes care of the following operations:

  1. Formats the first and the secondary disk (if present) and creates partitions
  2. Installs the system with a limited set of packages
  3. Registers the system on RHSM (Red Hat Subscription Manager) and updates it
  4. Enables the GNOME internal repository and populates /etc/hosts and /etc/resolv.conf with the needed entries
  5. Configures Puppet and fires up an agent run on the fresh system

About 5. make sure you are looking at puppetca --list on puppet.gnome.org so that you can mark the new host certificate as trusted when the system tries to bind with the Puppetmaster. The --waitforcert flag is currently 2 minutes, thus that's the actual time you have to puppetca --sign <name>.gnome.org.

Puppet mount points configuration

Once the virtual machine has been installed you should be able to include the needed mount points on Puppet making sure /etc/fstab is populated accordingly:

        file { "/mnt/live-data": ensure => directory; }
        mount { "/mnt/live-data":
                        atboot => true,
                        device => "/dev/vdb",
                        ensure => "mounted",
                        fstype => "ext4",
                        options => "defaults,noatime",
                        require => File["/mnt/live-data"];
        }

        file { "/srv/http": ensure => directory; }
        mount { "/srv/http":
                        atboot => true,
                        device => "/mnt/live-data/http",
                        ensure => "mounted",
                        fstype => "none",
                        options => "bind",
                        require => [ File["/srv/http"], Mount["/mnt/live-data"] ];
        }

Repository mirror

Cobbler manages the internal GNOME repositories, including a package is as easy as copying it on combobox.gnome.org:/home/admin/pkgs, make sure to include it on the correct directory which matches the RHEL release and architecture.

Once done, sync the repository with:

cobbler reposync

For more details on the available repositories run:

cobbler repo list

Alternative Manual Installation (Obsolete)

Create a new system with cobbler and configure all the relevant details as follows:

cobbler system copy --name=<existing> --newname=<name>
cobbler system edit --name=<name> --kopts='console=ttyS0,115200 ip=<private_ip>' --ksmeta="private_ip=<private_ip> public_ip=<public_ip>"
cobbler system edit --name=<name> --interface eth0 --ip-address=<public_ip>
cobbler system edit --name=<name> --interface eth1 --ip-address=<private_ip>

Create two logical volumes for the new VM:

lvcreate vg_clutter --name <name>-disk -L 20G
lvcreate vg_clutter --name <name>-data -L 50G

mkfs -t ext4 /dev/mapper/vg_clutter-<name>--data

Create the new VM with virt-install:

Note: virt-type kvm isn't available on older libvirt installs like the one hosted on combobox, use --accelerate instead.

virt-install --connect qemu:///system --name <name> --ram 2048 --vcpus 4 --vnc --virt-type kvm --location http://172.31.1.36/cblr/links/rhel-6.0-x86_64/ --arch x86_64 --os-variant rhel6 --disk path=/dev/mapper/vg_clutter-<name>--disk,size=20,driver_type=raw --network bridge=br0 --network bridge=br1 --wait 0 --noautoconsole -x "ks=http://172.31.1.36/cblr/svc/op/ks/system/<name> ip=172.31.1.45 netmask=255.255.255.0 gateway=209.132.180.190 dns=209.132.180.181 console=tty0"

Configure the new host by adding the data volume to the /etc/libvirt/qemu/<name>.xml file and set it up with ../Puppet.

Sysadmin/Cobbler (last edited 2015-05-05 23:50:28 by AndreaVeri)