Centos7.3 Cobbler自动化批量系统部署

一、Cobbler概述
Cobbler 是一个系统启动服务(boot server),可以通过网络启动(PXE)的方式用来快速安装、重装物理服务器和虚拟机,支持安装不同的 Linux 发行版和 Windows。该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理 DHCP,DNS,以及yum包镜像。
Cobbler 使用命令行方式管理,也提供了基于 Web 的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler提供以下服务集成:
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
yum仓库管理
TFTP (PXE启动时需要)
Apache(提供kickstart 的安装源,并提供定制化的kickstart配置)
同时,它和apache做了深度整合。通过 cobbler,可以实现对RedHat/Centos/Fedora系统的快速部署,同时也支持Suse 和Debian(Ubuntu)系统。
cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少。和 Kickstart不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导 致启动终止。
通过配置cobbler自动部署DHCP、TFTP、HTTP,在安装过程中加载kiskstart无人值守安装应答文件实现无人值守。从客户端使用PXE引导启动安装。
1.Cobbler工作流程

2.Cobbler各个组件之间关系

distro->profile-system(可选)
	distro 发行版
	面对不同的操作系统
	面对同一个操作系统不同的版本
	profile
	核心特性是通过kickstart来部署
	system
	主要目的配置网络接口
三、Cobbler安装及配置
1.安装Cobbler
[root@ops-cobbler ~]# yum install cobbler cobbler-web pykickstart httpd dhcp tftp xinetd
[root@ops-cobbler ~]# systemctl enable httpd
[root@ops-cobbler ~]# systemctl start httpd
[root@ops-cobbler ~]# systemctl start cobblerd 
[root@ops-cobbler ~]# systemctl enable cobblerd 

2.安装包说明
cobbler          #cobbler程序包
cobbler-web      #cobbler的web服务包
pykickstart      #cobbler检查kickstart语法错误
httpd            #Apache web服务
dhcp             #Dhcp服务
tftp             #tftp服务

/etc/cobbler                        # 配置文件目录
/etc/cobbler/settings               # cobbler主配置文件
/etc/cobbler/dhcp.template          # DHCP服务的配置模板
/etc/cobbler/tftpd.template         # tftp服务的配置模板
/etc/cobbler/rsync.template         # rsync服务的配置模板
/etc/cobbler/iso                    # iso模板配置文件目录
/etc/cobbler/pxe                    # pxe模板文件目录
/etc/cobbler/power                  # 电源的配置文件目录
/etc/cobbler/users.conf             # Web服务授权配置文件
/etc/cobbler/users.digest           # web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template       # DNS服务的配置模板
/etc/cobbler/modules.conf           # Cobbler模块配置文件
/var/lib/cobbler                    # Cobbler数据目录
/var/lib/cobbler/config             # 配置文件
/var/lib/cobbler/kickstarts         # 默认存放kickstart文件
/var/lib/cobbler/loaders            # 存放的各种引导程序
/var/www/cobbler                    # 系统安装镜像目录
/var/www/cobbler/ks_mirror          # 导入的系统镜像列表
/var/www/cobbler/images             # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror        #  yum源存储目录
/var/log/cobbler                    # 日志目录
/var/log/cobbler/install.log        # 客户端系统安装日志
/var/log/cobbler/cobbler.log        # cobbler日志

3.检查配置文件
需要在cobblerd和httpd启动的情况下检查
检查存在的问题,逐一解决

[root@ops-cobbler ~]# cobbler check 
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
    https://github.com/cobbler/cobbler/wiki/Selinux
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
6 : enable and start rsyncd.service with systemctl
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

1、sed -i 's/server: 127.0.0.1/server: 172.16.8.240/' /etc/cobbler/settings && grep -n 'server' /etc/cobbler/settings

2、sed -i 's/next_server: 127.0.0.1/next_server: 172.16.8.240/' /etc/cobbler/settings  && grep -n 'next_server' /etc/cobbler/settings

4、vim /etc/xinetd.d/tftp
 disable = yes 改为   disable = no

5、cobbler get-loaders

6、systemctl enable rsyncd

7、yum -y install debmirror cman
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值