1.启动菜单信息
在启动菜单里面,local是默认选项,之后才是我们自定义的启动项,在下面的模板中可以看出ONTIMEOUT 超时后会以$pxe_timeout_profile这个变量的值来启动
[root@cobbler kickstarts]# cat /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
查看源代码,pxe_timeout_profile是从system中取的,如果没有设置的话默认会设置为local
def make_pxe_menu(self):
"""
Generates both pxe and grub boot menus.
"""
only do this if there is NOT a system named default.
default = self.systems.find(name="default")
if default is None:
timeout_action = "local"
else:
timeout_action = default.profile
menu_items = self.get_menu_items()
# Write the PXE menu:
metadata = {"pxe_menu_items": menu_items['pxe'], "pxe_timeout_profile": timeout_action}
outfile = os.path.join(self.bootloc, "pxelinux.cfg", "default")
template_src = open(os.path.join(self.settings.boot_loader_conf_template_dir, "pxedefault.template"))
template_data = template_src.read()
self.templar.render(template_data, metadata, outfile, None)
template_src.close()
# Write the grub menu:
outfile = os.path.join(self.bootloc, "grub", "menu_items.cfg")
fd = open(outfile, "w+")
fd.write(menu_items['grub'])
fd.close()
2.修改启动菜单
添加一个system的配置 最主要的就是这个配置,就可以实现了
cobbler systemc add --name=default --profile=CentOS-7.6-x86_64
--name 可自定义名字
--profile 选择要安装的镜像
检查一下cobbler的system列表
[root@cobbler kickstarts]# cobbler system list
default
同步cobbler
[root@cobbler kickstarts]# cobbler sync
查看配置
[root@cobbler kickstarts]# cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-7.6-x86_64
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL CentOS-7.6-x86_64
kernel /images/CentOS-7.6-x86_64/vmlinuz
MENU LABEL CentOS-7.6-x86_64
append initrd=/images/CentOS-7.6-x86_64/initrd.img ksdevice=bootif
lang= kssendmac text
ks=http://192.168.254.150/cblr/svc/op/ks/profile/CentOS-7.6-x86_64
ipappend 2
MENU end
3.扩展
如果要隐藏local选项,还可以把local那四行备注掉
还有10秒内启动,可以把TIMEOUT后的200改成100
[root@cobbler kickstarts]# cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 100 #这一处改成100
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-7.6-x86_64
#LABEL local 这里的四行备注掉就好啦
# MENU LABEL (local)
# MENU DEFAULT
# LOCALBOOT -1
LABEL CentOS-7.6-x86_64
kernel /images/CentOS-7.6-x86_64/vmlinuz
MENU LABEL CentOS-7.6-x86_64
append initrd=/images/CentOS-7.6-x86_64/initrd.img ksdevice=bootif
lang= kssendmac text
ks=http://192.168.254.150/cblr/svc/op/ks/profile/CentOS-7.6-x86_64
ipappend 2
MENU end
然后就可以开始安装啦
4.结果