前面提到了使用cobbler进行自动化部署系统,下面我们介绍下如何利用cobbler快速搭建openstack本地源(这里我以我的测试环境中的openstack的Mitaka版本为例)。
操作步骤如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
1、添加openstack源: [root@cobbler ~] # cobbler repo add --name=openstack-mitaka --mirror=http://mirrors.163.com/centos/7.3.1611/cloud/x86_64/openstack-mitaka/ --arch=x86_64 --breed=yum
2、同步yum仓库内容到本地 [root@cobbler ~] # cobbler reposync
3、将repo添加到profile [root@cobbler ~] # cobbler profile edit --name=CentOS-7.3-x86_64.cfg --repos="openstack-mitaka" --distro=CentOS-7.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.3-x86_64.cfg
说明:安装系统时会自动添加仓库配置 4、添加更新仓库源的计划任务 [root@cobbler ~] # echo "0 1 * * 0" cobbler reposync --tries=3 --no-fail>>/var/spool/cron/root
说明:设置每周日的凌晨1点进行同步 5、装机自动配置yum [root@cobbler ~] # vim /etc/cobbler/setting
yum_post_install_mirror: 1 6、修改ks文件(我在附件中会放一份最新的) 说明:在%post与%end之间添加一句“$yum_config_stanza” %post $yum_config_stanza %end 7、安装好的系统测试下安装openstack的组件 [root@localhost ~] # cd /etc/yum.repos.d/
[root@localhost yum.repos.d] # ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo cobbler-config.repo [root@localhost yum.repos.d] # cat cobbler-config.repo
# error: could not read repo source: /var/www/cobbler/ks_mirror/config/CentOS-7.3-x86_64-0.repo [openstack-mitaka] name=openstack-mitaka baseurl=http: //10 .10.10.222 /cobbler/repo_mirror/openstack-mitaka
enabled=1 priority=99 gpgcheck=0 [root@localhost yum.repos.d] # yum install openstack-glance -y
--------------------中间过程忽略---------------------
python2-swiftclient.noarch 0:3.0.0-3.el7 python2-taskflow.noarch 0:1.30.0-3.el7
python2-urllib3.noarch 0:1.16-1.el7 python2-wsme.noarch 0:0.8.0-1.el7
pytz.noarch 0:2012d-5.el7
Complete! 说明,速度杠杠的 |
到此,整个配置完成。
本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1909286,如需转载请自行联系原作者