《Cobbler部署指南》系列
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
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment : rhel6.4
Fetchable Files : {}
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 : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos6.4-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
……略……
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 ]
received on stderr:
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密碼
支持兩種不一樣類型的密碼:
或
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
修改完畢注意檢查、同步配置使其生效
cobbler check
No configuration problems found. All systems go.
cobbler sync
PXE
裝機時選擇裝機系統版本,輸入裝機密碼,效果圖
4.13 定製PXE菜單TITLE
編輯pxedefault文件,
前端
vim /etc/cobbler/pxe/pxedefault.template
python
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
linux
將原文上面的內容根據自定義進行修改
web
MENU TITLE Hexun Automation Install System
shell
修改後的文件
vim
DEFAULT menu
centos
PROMPT 0
瀏覽器
MENU TITLE Hexun Automation Install System
安全
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
修改完畢執行以下兩條命令
cobbler check
cobbler sync
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
5、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
輸入用戶名密碼
登陸後的頁面
web管理相對易於使用管理這裏這就再也不贅述。
請看《Cobbler部署指南》系列續文
《Cobbler部署指南》系列文檔下載:http://down.51cto.com/data/745895