自動化工具分為三大類
- 預備類(Os Provisioning)
- PXE
- cobbler
- 配置管理類(Os config & Devops )
- cfengine
- chef
- puppet
- saltstack
- func
- fabric
- ansible
- 監(jiān)控類(Mointor)
- Cacti
- Nagios Core
- Zabbix
- Zenoss core
網站灰度發(fā)布(依賴于前端的lb實現)
- 關閉Directory上一批服務器
- 關閉這些服務器要更新的應用
- 更新webapp代碼至目標主機
- 啟動目標應用 练链,Dirtectory啟動這批服務器
發(fā)布大致流程
- 代碼控制(csv措伐,svn,git)檢出要發(fā)布的代碼,發(fā)布至預發(fā)布服務器上
- 預發(fā)布服務器: 預發(fā)布服務器跟線上服務器環(huán)境一致号杠,但不加入線上機器中,實施詳細的測試
- 自動化測試君珠,使用webapp自動化測試工具(如thoughworks開發(fā)的selenium)可以進行完整的代碼茅特,瀏覽器兼容性的測試
- 自動化灰度發(fā)布,線上批量分批次更新代碼
網站運行監(jiān)控
- 監(jiān)控數據采集爵川,用戶行為日志敷鸦,服務器性能監(jiān)控,運行數據報告
- 監(jiān)控管理 異常報警,失敗轉移扒披,自動優(yōu)雅降級
前言
運維自動化在生產環(huán)境中占據著舉足輕重的地位值依,尤其是面對幾百臺,幾千臺甚至幾萬臺的服務器時碟案,僅僅是安裝操作系統(tǒng)愿险,如果不通過自動化來完成,根本是不可想象的价说。記得前面我們探究了基于PXE實現系統(tǒng)全自動安裝辆亏,但PXE同時只能提供單一操作系統(tǒng)的批量部署,面對生產環(huán)境中不同服務器的需求熔任,該如何實現批量部署多版本的操作系統(tǒng)呢褒链?Cobbler便可以的滿足這一實際需求,本文帶來的是基于Cobbler實現多版本操作系統(tǒng)批量部署疑苔。
cobbler 簡介
Cobbler是一款自動化操作系統(tǒng)部署的實現工具甫匹,由Python語言開發(fā),是對PXE的二次封裝惦费。融合多種特性兵迅,提供了CLI和Web的管理形式。同時薪贫,Cobbler也提供了API接口恍箭,方便二次開發(fā)使用。它不僅可以安裝物理機瞧省,同時也支持kvm扯夭、xen虛擬化、Guest OS的安裝鞍匾。另外交洗,它還能結合Puppet等集中化管理軟件,實現自動化管理橡淑。
組件
Cobbler的各主要組件間關系如圖所示
cobbler 服務集成
- pxe 服務
- DHCP
- Rsync
- Http
- DNS
- Kickstart
- IPMI 電源管理
cobbler 設計方式
- 發(fā)行版(distro) :表示一個操作系統(tǒng)构拳,它承載了內核和initrd的信息,以及內核等其他數據
- 存儲庫 (repository):保存了一個yum或者rsync存儲庫的鏡像信息
- 配置文件(profile):包含了一個發(fā)行版(distro)梁棠,一個kickstart文件以及可能的存儲庫(repository)置森,還包含了更多的內核參數等其他數據
- 系統(tǒng)(system):表示要配給的機器,它包含了一個配置文件或一個鏡像符糊,還包含了ip和mac地址凫海,電源管理(地址,憑據,類型)以及更為專業(yè)的數據信息
- 鏡像(image):可替換一個包含不屬于此類別的文件的發(fā)行版對象(eg: 無法作為內核和initrd的對象)
以上各個組件中, 發(fā)行版男娄,存儲庫行贪, 配置文件為必須配置項
只有在虛擬環(huán)境中把兔,必須要用cobbler來引導虛擬機啟動時候,才會用到系統(tǒng)組件
但事實上瓮顽,在生產環(huán)境中需要大量的虛擬機實例的話,通常利用openstack等來實現虛擬機節(jié)點
cobbler 運行流程
- dhcp
- client: 從dhcp中獲取地址围橡,訪問next_server的ip地址
- next_server : 獲取啟動內核暖混,initrd等文件
- tftp: pxe引導文件,啟動cobbler選擇界面
- kickstart: 確定加載項翁授,根據nfs拣播,http,tfp等共享獲取資源
cobbler units
- cobbler
- cobbler-web
配置cobbler 步驟
1 安裝cobbler收擦,依據cobbler check檢查結果贮配,對setting主配置文件,進行相關的修正配置
2 啟動相關的http塞赂,cobbler服務泪勒,使用cobbler sync同步設置
3 配置cobbler 所依賴的包
* dhcp
* dns
* rsync
* tftp
4 配置cobbler組件
**針對步驟3 ,需要:
1 選定要使用的程序宴猾,選其一管理即可
2 確定是獨立管理這些服務圆存,還有由cobbler代為管理
**
*注意事項:
cobbler本身是不提供對應的服務程序的,因此還是需要安裝對應的程序服務的rpm包仇哆,并保證其開啟動的狀態(tài)沦辙,由cobbler管理這些服務 *
安裝cobbler
安裝epel源
[root@kvm ~]# yum install -y wget
[root@kvm ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
設置ip轉發(fā)
[root@kvm ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
[root@kvm ~]# sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
[root@kvm ~]# sysctl -p
安裝cobbler
[root@kvm ~]# yum -y install cobbler dhcp httpd xinetd tftp-server syslinux pykickstart xinetd rsync cobbler-web
cobbler 各種配置目錄說明
配置文件目錄 /etc/cobbler
- /etc/cobbler/settings : cobbler 主配置文件
- /etc/cobbler/iso/: iso模板配置文件
- /etc/cobbler/pxe: pxe模板文件
- /etc/cobbler/power: 電源配置文件
- /etc/cobbler/user.conf: web服務授權配置文件
- /etc/cobbler/users.digest: web訪問的用戶名密碼配置文件
- /etc/cobbler/dhcp.template : dhcp服務器的的配置末班
- /etc/cobbler/dnsmasq.template : dns服務器的配置模板
- /etc/cobbler/tftpd.template : tftp服務的配置模板
- /etc/cobbler/modules.conf : 模塊的配置文件
數據目錄
- /var/lib/cobbler/config/: 用于存放distros,system讹剔,profiles 等信息配置文件
- /var/lib/cobbler/triggers/: 用于存放用戶定義的cobbler命令
- /var/lib/cobbler/kickstart/: 默認存放kickstart文件
- /var/lib/cobbler/loaders/: 存放各種引導程序
鏡像目錄
- /var/www/cobbler/ks_mirror/: 導入的發(fā)行版系統(tǒng)的所有數據
- /var/www/cobbler/images/ : 導入發(fā)行版的kernel和initrd鏡像用于遠程網絡啟動
- /var/www/cobbler/repo_mirror/: yum 倉庫存儲目錄
日志目錄
- /var/log/cobbler/installing: 客戶端安裝日志
- /var/log/cobbler/cobbler.log : cobbler日志
cobbler commands
- import
- sync
- reposync
- build iso (使用發(fā)行版油讯,配置文件,制作系統(tǒng)鏡像)
- command line search
- replication
- valication kickstart
動態(tài)更新配置
對于Cobbler2.4來說延欠,有一個重要的功能陌兑,就是讓你可以不需要手工去編輯setting配置文件,直接使用命令去修改衫冻,默認這個功能是不啟用诀紊,你需要啟用。
[root@kvm cobbler]# cp settings settings.bak
[root@kvm cobbler]# sed -i 's/^[[:space:]]\+/ /' /etc/cobbler/settings
[root@kvm cobbler]# sed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/g' /etc/cobbler/settings
[root@kvm cobbler]# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
建議采用修改/etc/cobbler/settings配置文件的方式修改相關配置選項
檢查需要安裝的配置
[root@note1 ~]# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
7 : reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
我這里人品不好隅俘,出現了十個邻奠,真夠多的
解決1,2問題
1: [root@kvm cobbler]# cobbler setting edit --name=server --value=10.10.10.10
2: [root@kvm cobbler]# cobbler setting edit --name=next_server --value=10.10.10.10
解決3,5問題
[root@note1 cobbler]# chkconfig tftp on
[root@note1 cobbler]# chkconfig rsync on
[root@note1 cobbler]# /etc/init.d/xinetd restart
解決4問題
下載啟動菜單
[root@note1 cobbler]# cobbler get-loaders
解決6問題
配置防火墻,我的防火墻是開啟的为居,配置完策略后碌宴,但還是報,但是后期不耽誤正常配置蒙畴,不知道什么原因
iptables -A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 80,443,88,25151 -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp -m multiport --dports 53,67,68,25252 -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT
7問題
配置管理repo倉庫的贰镣,可以忽略
8問題
跟debian系統(tǒng)有關呜象,如果有需要裝一下即可,否則可以忽略
yum -y install debmirror
解決9問題
[root@note1 loaders]# openssl passwd -1 -salt `openssl rand -hex 4` "budongshu"
$1$557d907c$AmKQun9Jxitt1D6aQ8DUC.
[root@kvm cobbler]# cobbler setting edit --name=default_password_crypted --value="$1$557d907c$AmKQun9Jxitt1D6aQ8DUC." #如果命令不生效碑隆,去手動配置文件修改
解決10問題
yum install -y cman #安裝電源管理工具
防止誤重裝系統(tǒng)恭陡,選項pxe_just_one
[root@note1 cobbler]# cobbler setting edit --name=pxe_just_once --value=1
配置rsync,tftp 服務 由cobbler管理
- 默認情況下上煤,cobbler安裝完后休玩,會自己去管理tftp服務器,因manage_tftp
和managed_tftpd 的值默認為1 - 配置tftp rsync 服務劫狠,保證服務已經安裝拴疤,并且設置為開機自動啟動
- 需要保證xinetd服務為開機自動啟動狀態(tài),因rsync独泞,tftp 服務由xinetd服務統(tǒng)一管理
前面執(zhí)行chkconfig rysnc on 和chkconfig tftp on,diable 應該就是yes了呐矾,配置文件/etc/xinetd.d/rsync
[root@note1 cobbler]# chkconfig --level 35 xinetd on
配置dhcp服務由cobbler來管理(這里使用cobbler管理dhcp器,也可以使用dnsmasq來管理)
配置dhcpd配置文件
[root@note1 cobbler]# vim /etc/cobbler/dhcp.template
#其他暫時不需要動懦砂,只修改下面的幾個內容
subnet 10.10.10.0 netmask 255.255.255.0 {
option routers 10.10.10.10;
option domain-name-servers 114.114.114.114 ;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.10.10.20 10.10.10.50;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
此時的dhcpd的配置就被cobbler覆蓋 蜒犯,由cobbler來管理配置文件,截取的一部分荞膘,后面還有內容
[root@note1 cobbler]# vim /etc/dhcp/dhcpd.conf
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Sun Jan 31 15:47:49 2016)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# *****************************************************************
ddns-update-style interim;
allow booting
allow bootp
ignore client-updates;
set vendorclass = option vendor-class-identifier
option pxe-system-type code 93 = unsigned integer 16;
subnet 10.10.10.0 netmask 255.255.255.0 {
--------
同步cobbler
[root@kvm cobbler]# service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@kvm cobbler]# cobbler sync
task started: 2015-11-06_094656_sync
task started (id=Sync, time=Fri Nov 6 09:46:56 2015)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
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 ***
重啟
[root@kvm cobbler]# service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
再次檢查
[root@kvm cobbler]# cobbler check #除了上邊剛才必須修改的愧薛,以下的錯誤,不耽誤正常配置
啟動相關服務
[root@kvm ~]# chkconfig httpd on
[root@kvm ~]# chkconfig cobblerd on
[root@kvm Data]# chkconfig tftp on
[root@kvm Data]# chkconfig rsync on
[root@kvm Data]# chkconfig xinetd on
[root@kvm Data]# service xinetd start
[root@kvm Data]# service cobblerd start
[root@kvm Data]# service httpd start
編寫啟動腳本
cat >>/etc/init.d/cobbler<<EOF
#!/bin/bash
# chkconfig: 345 80 90
# description:cobbler
case \$1 in
start)
/etc/init.d/httpd start
/etc/init.d/xinetd start
/etc/init.d/dhcpd start
/etc/init.d/cobblerd start ;;
stop)
/etc/init.d/httpd stop
/etc/init.d/xinetd stop
/etc/init.d/dhcpd stop
/etc/init.d/cobblerd stop ;;
restart)
/etc/init.d/httpd restart
/etc/init.d/xinetd restart
/etc/init.d/dhcpd restart
/etc/init.d/cobblerd restart ;;
status)
/etc/init.d/httpd status
/etc/init.d/xinetd status
/etc/init.d/dhcpd status
/etc/init.d/cobblerd status ;;
sync)
cobbler sync ;;
*)
echo "Input error,please in put 'start|stop|restart|status|sync'!"
exit 2 ;;
esac
EOF
# chmod +x /etc/init.d/cobbler
# chkconfig cobbler on
配置命令
[root@linux-node1 ~]# cobbler
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
[add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]
[root@linux-node1 ~]# cobbler import --help # 導入鏡像
Usage: cobbler [options]
Options:
-h, --help show this help message and exit
--arch=ARCH OS architecture being imported
--breed=BREED the breed being imported
--os-version=OS_VERSION
the version being imported
--path=PATH local path or rsync location
--name=NAME name, ex 'RHEL-5'
--available-as=AVAILABLE_AS
tree is here, don't mirror
--kickstart=KICKSTART_FILE
assign this kickstart file
--rsync-flags=RSYNC_FLAGS
pass additional flags to rsync
cobbler check 核對當前設置是否有問題
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的詳細信息
cobbler sync 同步配置到數據目錄,更改配置最好都要執(zhí)行下
cobbler reposync 同步y(tǒng)um倉庫
cobbler distro 查看導入的發(fā)行版系統(tǒng)信息
cobbler system 查看添加的系統(tǒng)信息
cobbler profile 查看配置信息
導入系統(tǒng)到cobbler
centos6.5
[root@kvm cobbler]# mount /dev/cdrom /mnt
[root@note1 cobbler]# cobbler import --path=/mnt/ --name=Centos-6.5-x86_64 --arch=x86_64
[root@note1 cobbler]# cobbler distro report --name=Centos-6.5-x86_64
Name : Centos-6.5-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/Centos-6.5-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/Centos-6.5-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/Centos-6.5-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
centos7
[root@note1 ~]# umount /mnt
[root@note1 cobbler]# cobbler import --path=/mnt/ --name=Centos-7-x86_64 --arch=x86_64
[root@note1 kickstarts]# cobbler distro report --name=Centos-7-x86_64
Name : Centos-7-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/Centos-7-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/Centos-7-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/Centos-7-x86_64'}
Management Classes : []
OS Version : rhel7
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
查看
[root@note1 cobbler]# cobbler distro list
Centos-6.5-x86_64
Centos-7-x86_64
修改默認ks文件
配置centos6.5
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# Install OS instead of upgrade
install
# Use network installation
url --url=$tree
# Use text mode install
text
# System language
lang en_US
# System keyboard
keyboard us
# Clear the Master Boot Record
zerombr
# System bootloader configuration
bootloader --location=mbr
# System timezone
timezone America/Shanghai
# System authorization information
auth --useshadow --enablemd5
#Root password
rootpw --iscrypted $default_password_crypted
# Network information
$SNIPPET('network_config')
# Partition clearing information
clearpart --all --initlabel
# Allow anaconda to partition the system as needed
part /boot --fstype ext4 --size 200
part swap --fstype swap --size 2000
part / --fstype ext4 --size 20000
part /data --fstype ext4 --size 1 --grow
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# SELinux configuration
selinux --disabled
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Reboot after installation
reboot
# Do not configure the X Window System
skipx
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
lrzsz
tree
wget
curl
openssh
openssl
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
mkdir /root/backup
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
yum -y install git lrzsz
%end
到此centos6.5系統(tǒng)就可以裝機了
配置centos7
[root@note1 kickstarts]# cat CentOS-7-x86_64.cfg
#obbler for Kickstart Configurator for CentOS 7.1 by yao zhang
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr
# Network information
$SNIPPET('network_config')
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 500
part swap --size 2000
part / --fstype xfs --size 20000
part /data --fstype xfs --size 30000
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
%end
%post
systemctl disable postfix.service
%end
修改centos7 網卡label
# 修改安裝系統(tǒng)的內核參數衫画,在CentOS7系統(tǒng)有一個地方變了毫炉,就是網卡名變成eno16777736這種形式,但是為了運維標準化削罩,
# 我們需要將它變成我們常用的eth0瞄勾,因此使用下面的參數。但要注意是CentOS7才需要下面的步驟弥激,CentOS6不需要进陡。
[root@note1 kickstarts]# cobbler profile edit --name=CentOS-7.1-x86_64 --kopts='net.ifnames=0 biosdevname=0'
[root@note1 kickstarts]# cobbler profile report --name=CentOS-7-x86_64
Name : CentOS-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : Centos-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
查看
[root@note1 kickstarts]# cobbler profile report Centos-7-x86_64
[root@note1 kickstarts]# cobbler profile report Centos-6.5-x86_64
[root@note1 kickstarts]# cobbler list
distros:
Centos-6.5-x86_64
Centos-7-x86_64
profiles:
Centos-6.5-x86_64
Centos-7-x86_64
systems:
budongshu
repos:
images:
mgmtclasses:
packages:
files:
同步
[root@note1 kickstarts]# cobbler sync
配置repo倉庫
配置本地yum倉庫 (選配,可以不配置)
[root@localhost ~]# mkdir /tmp/rpms
[root@localhost ~]# createrepo /tmp/rpms #放入rpm包,執(zhí)行此步驟
[root@localhost ~]# cobbler repo add --mirror=/tmp/rpms --name=local
[root@localhost ~]# cobbler reposync
配置本地epel倉庫(選配,可以不配置)
[root@localhost ~]# cobbler repo add --mirror=http://mirrors.aliyun.com/epel/6/x86_64/ --name=epel
[root@localhost ~]# cobbler reposync --tries=3 --no-fail #同步epel倉庫到
本地,需要較長時間
查看已添加的repo(選配,可以不配置)
[root@localhost ~]# cobbler repo list
epel
local
添加repo到profile(選配,可以不配置)
[root@localhost ~]# cobbler profile edit --name=Centos-6.5-x86_64 --repos="epel local"
[root@localhost ~]# cobbler sync
綁定mac地址 ,實現開機自動選擇
配置綁定mac地址和IP地址 ,開機自動選擇
[root@note1 kickstarts]# cobbler system add --name=budongshu --mac=00:0C:29:48:1D:75 --profile=Centos-7-x86_64 \
--ip-address=10.10.10.23 --subnet=255.255.255.0 --gateway=10.10.10.10 --interface=eth0 \
--static=1 --hostname=budongshu --name-servers="114.114.114.114 8.8.8.8"
[root@note1 kickstarts]# cobbler sync
到此cento7系統(tǒng)的也可以裝機了,并且綁定了mac地址微服,固定了ip地址
web界面配置
cobbler-web支持多種認證方式趾疚,如authn_configfil、authn_ldap或authn_pam等以蕴,下面我們基于authn_pam做認證
修改認證方式
[root@note1 web]# vim /etc/cobbler/modules.conf
[authentication]
module = authn_pam
添加系統(tǒng)用戶
[root@note1 web]# useradd cobbler
[root@note1 web]# echo "cobbler" | passwd --stdin cobbler
添加用戶到管理組
[root@note1 web]# vim /etc/cobbler/modules.conf
[admins]
admin = "cobbler"
重啟服務
[root@note1 web]# service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@note1 web]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]