#####################################################
##如有轉載,請務必保留本文連結及版權資訊
##歡迎廣大運維同仁一起交流linux/unix網站運維技術!
##QQ:335623998
##E-mail:[email protected]
##部落格: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
《Cobbler部署指南》系列 1、《Cobbler部署指南之安裝篇》http://dreamway.blog.51cto.com/blog/1281816/1166589 2、《Cobbler部署指南之配置管理篇[上文]》http://dreamway.blog.51cto.com/blog/1281816/1166921 3、《Cobbler部署指南之配置管理篇[下文]》http://dreamway.blog.51cto.com/blog/1281816/1166932 4、《Cobbler部署指南之yum倉庫配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936 5、《Cobbler部署指南之Cobbler安裝作業系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166947 6、《Cobbler部署指南之安裝虛拟化Xen系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166950 7、《Cobbler部署指南之電源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957 8、《Cobbler部署指南之FAQ處理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078 4.8 自定義ks更改kickstart檔案,可為http等,具體cobbler --help檢視,這裡采用我們自定制ks檔案
ks目錄位置
/var/lib/cobbler/kickstarts/
預設的ks位置
/var/lib/cobbler/kickstarts/sample.ks
更改指定系統版本對應的ks配置檔案
cobbler profile edit --name=centos5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos5u8-x64.cfg
cobbler profile edit --name=centos6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u3-x64.cfg
cobbler profile edit --name=centos6.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u4-x64.cfg
4.9 配置資訊檢視cobbler report
distros:
==========
Name : centos5.8-xen-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment : rhel5.8
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos5.8-xen-x86_64'}
Management Classes : []
OS Version : rhel5
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
Name : centos6.4-x86_64
Comment : rhel6.4
Initrd : /var/www/cobbler/ks_mirror/centos6.4-x86_64/p_w_picpaths/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos6.4-x86_64/p_w_picpaths/pxeboot/vmlinuz
Kernel Options : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos6.4-x86_64'}
Management Classes : []
OS Version : rhel6
……略……
systems:
repos:
p_w_picpaths:
mgmtclasses:
packages:
files:
4.10 系統版本清單cobbler distro list
centos5.8-x86_64
centos5.8-xen-x86_64
centos6.3-x86_64
centos6.4-x86_64
4.11 同步Cobbler配置建議先執行cobbler check進行配置檢查再執行cobbler sync,修改cobbler配置後都需要執行此步驟
cobbler check
No configuration problems found. All systems go.
cobbler sync
task started: 2013-03-12_171702_sync
task started (id=Sync, time=Tue Mar 12 17:17:02 2013)
running pre-sync triggers
cleaning trees
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
4.12 建立PXE菜單密碼增加裝機安全設定菜單密碼
生成hash密碼
支援兩種不同類型的密碼:
sha1pass mypassword
或
openssl passwd -1 -salt sXiKzkus mypassword
我這裡選擇後者
# openssl passwd -1 -salt sXiKzkus hexun
$1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
編輯配置檔案pxedefault,添加如下藍色部分
vim /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
MENU MASTER PASSWD $1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
配置pxeprofile,增加藍色部分
vim /etc/cobbler/pxe/pxeprofile.template
LABEL $profile_name
MENU PASSWD
kernel $kernel_path
$menu_label
$append_line
ipappend 2
修改完畢注意檢查、同步配置使其生效
PXE裝機時選擇裝機系統版本,輸入裝機密碼,效果圖
4.13 定制PXE菜單TITLE
編輯pxedefault檔案,
将原文上面的内容根據自定義進行修改
MENU TITLE Hexun Automation Install System
修改後的檔案
修改完畢執行如下兩條指令
4.14 添加指定客戶機系統配置到Cobbler
4.14.1 指定一個網段使用特定的裝機配置
cobbler system add --name=network --ip=172.17.188.0/16 --profile=centos5.8-x86_64
4.14.2 添加一個指定伺服器的裝機配置
指定伺服器就是綁定它的mac位址,并設定好ip、dns、hostname
定義系統
cobbler system add --name=host-188116 --hostname=host-188116 --mac=00:19:B9:E5:34:FE --interface=eth0 --ip-address=172.17.188.116 --subnet=255.255.0.0 --gateway=172.17.188.1 --static=1 --profile=centos5.8-x86_64
檢視定義的系統清單
cobbler system list
host-188116
更多參數見cobbler system add --help
五、Cobbler Web管理
Cobbler web界面是一個很好的前端,非常容易管理Cobbler
可以添加和删除 system distro profile
可以檢視、編輯distros, profiles, subprofiles, systems, repos 、 kickstart檔案
5.1 安裝cobbler_web
yum -y install cobbler-web
5.2 設定使用者名密碼
為已存在的使用者cobbler重置密碼
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新使用者
htdigest /etc/cobbler/users.digest "Cobbler" your_newname
5.3 配置cobbler web可以登入
sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
5.4 重新開機Cobbler與http
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
5.5 通路Cobbler Web頁面
浏覽器通路登入頁面https://172.17.10.14/cobbler_web
輸入使用者名密碼
登入後的頁面