- cobbler重要目录和cobbler各对象的关系
/var/www/cobbler/ks_mirror 存放操作系统镜像
/var/www/cobbler/repo_mirror 存放仓库镜像
/var/lib/cobbler/kickstarts 存放kickstarts文件
/var/lib/cobbler/loaders 存放启动时需要的文件
/var/lib/cobbler/snippets 存放脚本
/etc/cobbler 存放cobbler的配置文
- 自定义yum源
cobbler可以管理yum源,以使用阿里云的openstack为例
http://mirrors.aliyun.com/centos/7.2.1511/cloud/x86_64/openstack-mitaka/
1) 添加openstack仓库源
cobbler repo add --name=openstack-mitaka --mirror=http://mirrors.aliyun.com/centos/7.2.1511/cloud/x86_64/openstack-mitaka/ --arch=x86_64 --breed=yum
2) 同步 cobbler reposync
3) 将openstack-mitaka在安装centos 7时,默认导入安装
cobbler profile edit --name=CentOS-7.1-x86_64 --repos="openstack-mitaka"
cobbler profile report CentOS-7.1-x86_64 查看仓库源
vim /etc/cobbler/settings 可以查看到yum_post_install_mirror默认开启
4) 修改kickstart文件
vim /var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg
#Kickstart Configurator for cobbler by Jason Zhao #platform=x86, AMD64, or Intel EM64T #System language lang en_US #System keyboard keyboard us #Sytem timezone timezone Asia/Shanghai #Root password rootpw --iscrypted $default_password_crypted #Use text mode install text #Install OS instead of upgrade install #Use NFS installation Media url --url=$tree #System bootloader configuration bootloader --location=mbr #Clear the Master Boot Record zerombr #Partition clearing information clearpart --all --initlabel #Disk partitioning information part /boot --fstype xfs --size 1024 --ondisk sda part swap --size 16384 --ondisk sda part / --fstype xfs --size 1 --grow --ondisk sda #System authorization infomation auth --useshadow --enablemd5 #Network information $SNIPPET(‘network_config‘) #network --bootproto=dhcp --device=em1 --onboot=on # Reboot after installation reboot #Firewall configuration firewall --disabled #SELinux configuration selinux --disabled #Do not configure XWindows skipx #Package install information %pre $SNIPPET(‘log_ks_pre‘) $SNIPPET(‘kickstart_start‘) $SNIPPET(‘pre_install_network_config‘) # Enable installation monitoring $SNIPPET(‘pre_anamon‘) %end %packages @ base @ core sysstat iptraf ntp lrzsz ncurses-devel openssl-devel zlib-devel OpenIPMI-tools mysql nmap screen %end %post systemctl disable postfix.service $yum_config_stanza %end
5) 添加定时任务,定期同步repo
echo "1 3 * * * /usr/bin/cobbler reposync --tries=3 --no-fail" >> /var/spool/cron/root