目的:为客户端自动添加上yum源
以下以openstack源为例
1、新建私有yum源 [root@localhost ~]#cobbler repo add --name=openstack-mitaka --mirror=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-mitaka/ --arch=x86_64 --breed=yum 2、同步源(下载到/var/www/cobbler/repo_mirror目录下) [root@localhost ~]#cobbler reposync 3、添加repo到对应的profile [root@localhost ~]#cobbler profile edit --name=CentOS-7-x86_64 --repos="openstack-mitaka" 4、修改kickstart文件、添加(%post %end之间) %post $yum_config_stanza %end
5、执行cobbler sync更新配置 6、添加定时任务,定期同步repo echo "1 3 * * * /usr/bin/cobbler reposync --tries=3 --no-fail" >>/var/spool/cron/root