【转载】自动化运维系列之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

相关文章
相关标签/搜索