Cobbler: Difference between revisions

From Leo's Notes
This page was last edited on 14 June 2020, at 23:33.
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 21: Line 21:
  - yum install pykickstart cman
  - yum install pykickstart cman


/etc/init.d/cobblerd restart
/etc/init.d/cobblerd restart
cobbler check  # should pass now except for the debian package manager.. but we don't care.
cobbler check  # should pass now except for the debian package manager.. but we don't care.
 
yum install cobbler-web
yum install cobbler-web
 
vi /etc/cobbler/modules.conf
vi /etc/cobbler/modules.conf
[authentication]
[authentication]
module = authn_configfile
module = authn_configfile
 
[authorization]
[authorization]
module = authz_allowall
module = authz_allowall
htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler
htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler
/etc/init.d/cobblerd restart
/etc/init.d/cobblerd restart


# if you get errors about authentication failure... try restarting cobbler again
# if you get errors about authentication failure... try restarting cobbler again
Line 45: Line 45:




cobbler distro add --name=CentOS6.3-x86_64 --kernel=/tftpboot/CentOS6.3-x86_64/isolinux/vmlinuz --initrd=/tftpboot/CentOS6.3-x86_64/isolinux/initrd.img
cobbler distro add --name=CentOS6.3-x86_64 --kernel=/tftpboot/CentOS6.3-x86_64/isolinux/vmlinuz --initrd=/tftpboot/CentOS6.3-x86_64/isolinux/initrd.img
cobbler profile add --name=CentOS6 --distro=CentOS6.3-x86_64 --kickstart=/tftpboot/kickstart/centos6-ks.cfg
cobbler profile add --name=CentOS6 --distro=CentOS6.3-x86_64 --kickstart=/tftpboot/kickstart/centos6-ks.cfg
 
# adding some systems
# adding some systems
cobbler system add --name=lab01 --hostname=lab01 --profile=CentOS6 --mac=00:50:56:3B:7A:4B --ip-address=10.10.2.11 --dns-name=lab01.lab.cpsc.ucalgary.ca
cobbler system add --name=lab01 --hostname=lab01 --profile=CentOS6 --mac=00:50:56:3B:7A:4B --ip-address=10.10.2.11 --dns-name=lab01.lab.cpsc.ucalgary.ca
cobbler system add --name=lab02 --hostname=lab02 --profile=CentOS6 --mac=00:0C:29:68:C6:A3 --ip-address=10.10.2.12 --dns-name=lab02.lab.cpsc.ucalgary.ca
cobbler system add --name=lab02 --hostname=lab02 --profile=CentOS6 --mac=00:0C:29:68:C6:A3 --ip-address=10.10.2.12 --dns-name=lab02.lab.cpsc.ucalgary.ca
cobbler system add --name=lab03 --hostname=lab03 --profile=CentOS6 --mac=00:0C:29:45:81:F8 --ip-address=10.10.2.13 --dns-name=lab03.lab.cpsc.ucalgary.ca
cobbler system add --name=lab03 --hostname=lab03 --profile=CentOS6 --mac=00:0C:29:45:81:F8 --ip-address=10.10.2.13 --dns-name=lab03.lab.cpsc.ucalgary.ca
cobbler system add --name=lab04 --hostname=lab04 --profile=CentOS6 --mac=00:50:56:27:0E:BD --ip-address=10.10.2.14 --dns-name=lab04.lab.cpsc.ucalgary.ca
cobbler system add --name=lab04 --hostname=lab04 --profile=CentOS6 --mac=00:50:56:27:0E:BD --ip-address=10.10.2.14 --dns-name=lab04.lab.cpsc.ucalgary.ca
cobbler system add --name=lab05 --hostname=lab05 --profile=CentOS6 --mac=00:50:56:34:DA:AA --ip-address=10.10.2.15 --dns-name=lab05.lab.cpsc.ucalgary.ca
cobbler system add --name=lab05 --hostname=lab05 --profile=CentOS6 --mac=00:50:56:34:DA:AA --ip-address=10.10.2.15 --dns-name=lab05.lab.cpsc.ucalgary.ca
 
# save changes
# save changes
/etc/init.d/cobblerd restart
/etc/init.d/cobblerd restart
cobbler sync
cobbler sync




Line 68: Line 68:
  - example:
  - example:


ddns-update-style interim;
ddns-update-style interim;
 
allow booting;
allow booting;
allow bootp;
allow bootp;
 
option domain-name "lab.cpsc.ucalgary.ca";
option domain-name "lab.cpsc.ucalgary.ca";
authoritative;
authoritative;
 
subnet 172.20.1.0 netmask 255.255.255.0 {
  subnet 172.20.1.0 netmask 255.255.255.0 {
    option routers            172.20.1.1;
      option routers            172.20.1.1;
    option domain-name-servers 172.20.1.2;
      option domain-name-servers 172.20.1.2;
    option subnet-mask        255.255.255.0;
      option subnet-mask        255.255.255.0;
    range dynamic-bootp        172.20.1.10 172.20.1.254;
      range dynamic-bootp        172.20.1.10 172.20.1.254;
    filename                  "/pxelinux.0";
      filename                  "/pxelinux.0";
    default-lease-time        21600;
      default-lease-time        21600;
    max-lease-time            43200;
      max-lease-time            43200;
    next-server                $next_server;
      next-server                $next_server;
}
}




Line 96: Line 96:
   
   
Using better loaders
Using better loaders
If you want custom loaders, you will need to place them under <code>/var/lib/cobbler/loaders</code> and modify cobbler to copy them over to <code>/tftpboot</code> during a sync.
If you want custom loaders, you will need to place them under {{code|/var/lib/cobbler/loaders}} and modify cobbler to copy them over to {{code|/tftpboot}} during a sync.


  cd /var/lib/cobbler/loaders
  cd /var/lib/cobbler/loaders
Line 117: Line 117:
  cobbler sync
  cobbler sync


<strong>Note:</strong> If you want to get away from the complexity, you can just place the loaders/roms directly in <code>/tftpboot</code> and call it a day.
<strong>Note:</strong> If you want to get away from the complexity, you can just place the loaders/roms directly in {{code|/tftpboot}} and call it a day.
 
{{Navbox Linux}}[[Category:Linux]]
[[Category:Todo]]

Latest revision as of 23:33, 14 June 2020


Add RH's repo to the system in /etc/yum.repos.d/blah

name = Extras
baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64
enabled = 1
gpgcheck = 0

yum install cobbler httpd xinetd tftp-server

vi /etc/selinux/config

- disable selinux

/etc/init.d/cobblerd start cobbler check

- should see an error message
- in /etc/cobbler/settings
  - change the 'server' and 'next_server' field 
  - change default password using `openssl passwd -1` 
- cobbler get-loaders
- yum install pykickstart cman
/etc/init.d/cobblerd restart
cobbler check   # should pass now except for the debian package manager.. but we don't care.

yum install cobbler-web

vi /etc/cobbler/modules.conf
[authentication]
module = authn_configfile

[authorization]
module = authz_allowall
htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler
/etc/init.d/cobblerd restart
  1. if you get errors about authentication failure... try restarting cobbler again
  1. You will probaby want to make cobbler manage dhcp as well...
  2. see https://github.com/cobbler/cobbler/wiki/DHCP%20management
  1. Need to now add distros...
  2. They are stored in /var/www/cobbler/ks_mirror/<distro name>


cobbler distro add --name=CentOS6.3-x86_64 --kernel=/tftpboot/CentOS6.3-x86_64/isolinux/vmlinuz --initrd=/tftpboot/CentOS6.3-x86_64/isolinux/initrd.img
cobbler profile add --name=CentOS6 --distro=CentOS6.3-x86_64 --kickstart=/tftpboot/kickstart/centos6-ks.cfg

# adding some systems
cobbler system add --name=lab01 --hostname=lab01 --profile=CentOS6 --mac=00:50:56:3B:7A:4B --ip-address=10.10.2.11 --dns-name=lab01.lab.cpsc.ucalgary.ca
cobbler system add --name=lab02 --hostname=lab02 --profile=CentOS6 --mac=00:0C:29:68:C6:A3 --ip-address=10.10.2.12 --dns-name=lab02.lab.cpsc.ucalgary.ca
cobbler system add --name=lab03 --hostname=lab03 --profile=CentOS6 --mac=00:0C:29:45:81:F8 --ip-address=10.10.2.13 --dns-name=lab03.lab.cpsc.ucalgary.ca
cobbler system add --name=lab04 --hostname=lab04 --profile=CentOS6 --mac=00:50:56:27:0E:BD --ip-address=10.10.2.14 --dns-name=lab04.lab.cpsc.ucalgary.ca
cobbler system add --name=lab05 --hostname=lab05 --profile=CentOS6 --mac=00:50:56:34:DA:AA --ip-address=10.10.2.15 --dns-name=lab05.lab.cpsc.ucalgary.ca

# save changes
/etc/init.d/cobblerd restart
cobbler sync


  1. You will want to make cobbler manage dhcp and dns
  2. Be sure to edit the template files:

vi /etc/cobbler/dhcpd.template

- be sure that the dns server is set correctly
- ensure the gateway is set 
- example:
ddns-update-style interim;

allow booting;
allow bootp;

option domain-name "lab.cpsc.ucalgary.ca";
authoritative;

 subnet 172.20.1.0 netmask 255.255.255.0 {
     option routers             172.20.1.1;
     option domain-name-servers 172.20.1.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        172.20.1.10 172.20.1.254;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}


vi /etc/cobbler/named.template

- make listen-on port 53 on any port to ensure that your build servers and talk to it
- ensure that recursion is enabled for all ips that are going to access the ns server


Using better loaders If you want custom loaders, you will need to place them under /var/lib/cobbler/loaders and modify cobbler to copy them over to /tftpboot during a sync.

cd /var/lib/cobbler/loaders
wget -O menu.c32 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/menu.c32
wget -O vesamenu.c32 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/vesamenu.c32
wget -O pxelinux.0 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/pxelinux.0
wget -O splash.png http://pages.cpsc.ucalgary.ca/~leo/support/pxe/splash.png

If you do add new loaders, you will need to add the code to copy them over manually. Edit /usr/lib/python2.6/site-packages/cobbler/pxegen.py

                utils.copyfile_pattern('/var/lib/cobbler/loaders/pxelinux.0',
                        dst, api=self.api, cache=False, logger=self.logger)
                utils.copyfile_pattern('/var/lib/cobbler/loaders/menu.c32',
                        dst, api=self.api, cache=False, logger=self.logger)
                utils.copyfile_pattern('/var/lib/cobbler/loaders/vesamenu.c32',
                        dst, api=self.api, cache=False, logger=self.logger)

/etc/init.d/cobblerd restart
cobbler sync

Note: If you want to get away from the complexity, you can just place the loaders/roms directly in /tftpboot and call it a day.