5. Import CentOS distribution and create a default profile

Systems managed by cobbler use profiles to be configured for installation. Profiles allow you to configure groups of systems in a common way. E.g. you can have a profile for compute nodes, a profile for login nodes, etc. Cobbler even allows profiles to be related to each other. A profile can inherit settings from a parent profile.

A typical usage is to have a generic CentOS7 profile and then customized ones for each hardware configuration or use case.

Profiles use a distribution as installation source. To create a system managed by cobbler, we therefore first have to create both a distribution and profile that uses it.

We do this by importing the CentOS Distribution from our ISO file. This will create a distribution and profile within cobbler.

  1. Mount ISO

    Mount the ISO as loopback device into a folder, e.g. /mnt/iso.

    # mount ISO image
    [root@master ~]# mkdir -p /mnt/iso
    [root@master ~]# mount CentOS-7-x86_64-Everything-2207-02.iso /mnt/iso
    
  2. Import CentOS distribution into cobbler

    Run the following command to import a distribution from /mnt/iso into cobbler. It will copy all necessary files for booting and all other files needed for installation. (this can take some time). You essentially did the same during exercise 2 manually.

    [root@master ~]# cobbler import --name=centos7 --arch=x86_64 --path=/mnt/iso
    task started: 2019-02-18_120725_import
    task started (id=Media import, time=Mon Feb 18 12:07:25 2019)
    Found a candidate signature: breed=redhat, version=rhel6
    Found a matching signature: breed=redhat, version=rhel6
    Adding distros from path /var/www/cobbler/ks_mirror/centos7-x86_64:
    creating new distro: centos7-x86_64
    trying symlink: /var/www/cobbler/ks_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
    creating new profile: centos7-x86_64
    associating repos
    checking for rsync repo(s)
    checking for rhn repo(s)
    checking for yum repo(s)
    starting descent into /var/www/cobbler/ks_mirror/centos7-x86_64 for centos7-x86_64
    processing repo at : /var/www/cobbler/ks_mirror/centos7-x86_64
    need to process repo/comps: /var/www/cobbler/ks_mirror/centos7-x86_64
    looking for /var/www/cobbler/ks_mirror/centos7-x86_64/repodata/*comps*.xml
    Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7-x86_64/repodata
    *** TASK COMPLETE ***
    

    After completion your imported distribution will be listed when you run cobbler distro list.

    [root@master ~]# cobbler distro list
       centos7-x86_64
    

    You can see all available cobbler distro commands by just entering

    [root@master ~]# cobbler distro
    usage
    =====
    cobbler distro add
    cobbler distro copy
    cobbler distro edit
    cobbler distro find
    cobbler distro list
    cobbler distro remove
    cobbler distro rename
    cobbler distro report
    

    Inspect your imported distribution with the cobbler distro report command:

    [root@master ~]# cobbler distro report --name=centos7-x86_64
    Name                           : centos7-x86_64
    Architecture                   : x86_64
    TFTP Boot Files                : {}
    Breed                          : redhat
    Comment                        :
    Fetchable Files                : {}
    Initrd                         : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img
    Kernel                         : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz
    Kernel Options                 : {}
    Kernel Options (Post Install)  : {}
    Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/centos7-x86_64'}
    Management Classes             : []
    OS Version                     : rhel6
    Owners                         : ['admin']
    Red Hat Management Key         : <<inherit>>
    Red Hat Management Server      : <<inherit>>
    Template Files                 : {}
    

    Here, cobbler falsely detected a RHEL6 distribution. Let’s correct this via cobbler distro edit:

    [root@master ~]# cobbler distro edit --name=centos7-x86_64 --os-version=rhel7
    [root@master ~]# cobbler distro report --name=centos7-x86_64
    Name                           : centos7-x86_64
    Architecture                   : x86_64
    TFTP Boot Files                : {}
    Breed                          : redhat
    Comment                        :
    Fetchable Files                : {}
    Initrd                         : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img
    Kernel                         : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz
    Kernel Options                 : {}
    Kernel Options (Post Install)  : {}
    Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/centos7-x86_64'}
    Management Classes             : []
    OS Version                     : rhel7
    Owners                         : ['admin']
    Red Hat Management Key         : <<inherit>>
    Red Hat Management Server      : <<inherit>>
    Template Files                 : {}
    

    During the import, cobbler also created a centos7-x86_64 profile for you, which uses the centos7-x86_64 distribution.

    [root@master ~]# cobbler profile list
       centos7-x86_64
    

    Similar to cobbler distro, all available sub-commands of cobbler profile can be seen by simply executing it:

    [root@master ~]# cobbler profile
    usage
    =====
    cobbler profile add
    cobbler profile copy
    cobbler profile dumpvars
    cobbler profile edit
    cobbler profile find
    cobbler profile getks
    cobbler profile list
    cobbler profile remove
    cobbler profile rename
    cobbler profile report
    

    Looking at a particular profile in detail is done using the cobbler profile report command:

    [root@master ~]# cobbler profile report --name=centos7-x86_64
    Name                           : centos7-x86_64
    TFTP Boot Files                : {}
    Comment                        :
    DHCP Tag                       : default
    Distribution                   : centos7-x86_64
    Enable gPXE?                   : 0
    Enable PXE Menu?               : 1
    Fetchable Files                : {}
    Kernel Options                 : {}
    Kernel Options (Post Install)  : {}
    Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks
    Kickstart Metadata             : {}
    Management Classes             : []
    Management Parameters          : <<inherit>>
    Name Servers                   : []
    Name Servers Search Path       : []
    Owners                         : ['admin']
    Parent Profile                 :
    Internal proxy                 :
    Red Hat Management Key         : <<inherit>>
    Red Hat Management Server      : <<inherit>>
    Repos                          : []
    Server Override                : <<inherit>>
    Template Files                 : {}
    Virt Auto Boot                 : 1
    Virt Bridge                    : xenbr0
    Virt CPUs                      : 1
    Virt Disk Driver Type          : raw
    Virt File Size(GB)             : 5
    Virt Path                      :
    Virt RAM (MB)                  : 512
    Virt Type                      : kvm
    
  3. Unmount ISO

    Finally unmount the ISO image.

    umount /mnt/iso