80652319 2017-05-05
运维自动化包括标准化、工具化、Web化、服务化、智能化等几个不同的层级,在一家规模稍大、拥有服务器上千台甚至是几万台的生产环境中,想要真正实现运维自动化,工具化系统安装流程、统一系统安装规范,是其中最不能忽略的重要环节。普通的自动化部署可以采用pxe+dhcp+tftp配合kickstart实现,但是面对多版本、多部署需求的情况下,这种普通的部署方式可能达不到我们的要求;这时候就需要借助cobbler开源自动化部署工具来实现。
Cobbler是一款快速的网络系统部署工具,其最大的特点是集合了所有系统部署所需服务,如DHCP、DNS、TFTP,这样你在部署一台操作系统的时候不需要在各个服务之前协调切换,Cobbler都可以替你来管理,Cobbler内部集成了一个镜像版本仓库,你可以自定义相关配置文件,实现不同系统不同安装需求的选择;当然,Cobbler还提供了包括yum源管理、Web界面管理、API接口、电源管理等功能,方便你自定义开发管理。
[blockquote]
[/blockquote]
[blockquote]
[root@sharestore py-9]# yum search epel-releaseLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com============================ N/S matched: epel-release ============================epel-release.noarch : Extra Packages for Enterprise Linux repository configuration
Name and summary matches only, use "search all" for everything.[root@sharestore py-9]# yum -y install epel-release
[root@sharestore py-9]# yum -y install cobbler
[/blockquote]
[blockquote]
查看安装了哪些文件到什么位置
[root@sharestore py-9]# rpm -ql cobbler
下面是一些重要的配置文件及说明:
/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日志
[/blockquote]
cobbler依赖httpd服务,所以要先启动httpd,否则会报错。
[root@sharestore]# systemctl start cobbler
[blockquote]
[root@sharestore]# cobbler check
[root@sharestore ~]# cobbler checkThe 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.
#这个提示是需要修改/etc/cobbler/settings 文件中server: 后面的IP地址,这个地址默认是127.0.0.1需要修改成可以通信的本机真实的网卡地址,以便提供DHCP等服务。
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.
#这个提示是说要想让PXE工作起来,需要设置/etc/cobbler/settings中next_server的ip地址,同样要求能够通信的IP地址。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
#这个提示要求关闭selinux4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
#提示要求启用tftp5 : 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.
#提示要求使用cobbler get-loaders从网上下载引导程序6 : enable and start rsyncd.service with systemctl
#提示要求启动 rsyncd服务7 : debmirror package is not installed, it will be required to manage debian deployments and repositories8 : ksvalidator was not found, install pykickstart
#提示要求安装pykickstart,使用yum –y pykickstart即可9 : 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:default_password_crypted "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
#提示要求修改默认密码"openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'"并替换settings中default_password_crypted引号中的内容
10 : 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.
[/blockquote]
#提示如果使用电源管理模块,安装cman 或者 fence-agents