【轉載】自動化運維繫列之Cobbler給Openstack節點安裝操做系統

preface

咱們在一篇博文知道了如何搭建Cobbler,那麼下面就經過Cobbler來安抓Openstack全部節點吧。html

服務器配置信息以下:node

主機名 IP 角色
Cobbler.node.com 192.168.56.10 cobbler
linux-node1.example.com 192.168.56.11 keystone+glance等控制節點
linux-node2.example.com 192.168.56.12 horizon+nova-computer等計算節點
  1. 內核爲3.10.0-514.2.2.el7.x86_64
  2. 網卡名字設置爲了eth0。
  3. 關閉了selinux,iptables。
  4. 時間同步ntp.chinacache.com

部署cobbler

部署的話參考上一篇博文:Cobbler的安裝
1.Cobbler安裝部署完成後,咱們須要添加 一個 Openstack倉庫:linux

[root@cobbler kickstarts]# cobbler repo add --name=Openstack-Newton --mirror=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-newton/ --arch=x86_64 --breed=yum [root@cobbler kickstarts]# cobbler reposync # 同步得有一會,取決於下載速度。

同步完成後,咱們在Cobbler-web界面來把Openstack的源添加到profile裏面去,這樣新安裝的操做系統自動Openstack-newton版本的yum源了。以下圖所示:
image
2.kickstart配置文件裏面添加一行命令:web

[root@cobbler kickstarts]# vim CentOS-7.1-x86_64_cobbler.cfg %post rpm -ihv https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm # 添加一個epel源 wget -SO /etc/yum.repos.d/Centos-7.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum clean all && yum -y install koan # 安裝koan %end

3.定製系統:
首先針對linux-node2節點:vim

[root@cobbler kickstarts]#cobbler system add --name=linux-node2 --mac=00:50:56:3E:61:CF \ --profile=CentOS-7.0-x86_64 \ --ip-address=192.168.56.12 --subnet=255.255.255.0 \ --gateway=192.168.56.2 --interface=eth0 \ --static=1 --hostname=linux-node2.example.com \ --name-servers="192.168.56.2" \ --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64_cobbler.cfg

再次針對linux-node1節點centos

cobbler system add --name=linux-node1 --mac=00:50:56:25:62:A4 \ --profile=CentOS-7.0-x86_64 \ --ip-address=192.168.56.11 --subnet=255.255.255.0 \ --gateway=192.168.56.2 --interface=eth0 \ --static=1 --hostname=linux-node1.example.com \ --name-servers="192.168.56.2" \ --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64_cobbler.cfg

若是是使用的vm虛擬機,請先關閉vmware虛擬機的DHCP功能,若是是在生產環境下,那麼請臨時關閉路由器或者三層交換機的dhcp功能,由Cobbler來提供dhcp功能。服務器

啓動Openstack節點服務器

咱們啓動Openstack節點服務器,一開機就進入到自動安裝系統的界面。待系統安裝完後,咱們就能夠看到主機名、ip、網關、防火牆之類的都是按照咱們的配置文件走的。
咱們看下yum源:koa

[root@linux-node2 ~]# cat /etc/yum.repos.d/cobbler-config.repo # error: could not read repo source: /var/www/cobbler/ks_mirror/config/CentOS-7.0-x86_64-0.repo  [Openstack-Newton] name=Openstack-Newton baseurl=http://192.168.56.10/cobbler/repo_mirror/Openstack-Newton enabled=1 priority=99 gpgcheck=0

已經安裝上了Newton版本的Openstack的yum源了,因此咱們在部署Openstack的節點的時候不須要執行yum -y install centos-release-openstack-newton
直接執行yum install Openstack組件就能夠了。
因爲是使用Cobbler的yum源,因此安裝Openstack的組件的時候,內網傳輸至關快了。post

相關文章
相關標籤/搜索