ng python triggers from /var/lib/cobbler/triggers/sync/post/*
36 running python trigger cobbler.modules.sync_post_restart_services
37 running: dhcpd -t -q
38 received on stdout:
39 received on stderr:
40 running: service dhcpd restart
41 received on stdout:
42 received on stderr: Redirecting to /bin/systemctl restart dhcpd.service
43
44 running shell triggers from /var/lib/cobbler/triggers/sync/post/*
45 running python triggers from /var/lib/cobbler/triggers/change/*
46 running python trigger cobbler.modules.scm_track
47 running shell triggers from /var/lib/cobbler/triggers/change/*
48 *** TASK COMPLETE ***
5.新建一个虚拟机测试
为避免发生未知问题,先把服务端所有服务重启
[root@localhost cobbler]#systemctl restart xinetd.service
[root@localhost cobbler]#systemctl restart cobblerd.service
[root@localhost cobbler]#systemctl restart httpd.service
新建虚拟机从pxe启动,如果出现下面图形,则说明已经成功了
上图中网址也可以定制为我们自己的
[root@localhost cobbler]# vim /etc/cobbler/pxe/pxedefault.template
MENU TITLE Cobbler | I'm here # 修改这里为你想修改的内容
[root@localhost cobbler]# cobbler sync # 同步之后就可以看到效果了
6.通过MAC地址定制化安装
我们可以根据不同的MAC地址来给安装 不同的操作系统,配置不同的静态iP,设置不同的主机名等等,虚拟机查看MAC地址步骤如图:
配置定制化安装(需要验证,后续验证后添加验证结果)
[root@localhost cobbler]# cobbler system add \
--name=linux-web01 \
--mac=00:0C:29:3B:03:9B \
--profile=Centos-7.2-x86_64 \
--ip-address=10.0.0.200 \
--subnet=255.255.255.0 \
--gateway=10.0.0.2 \
--interface=eth0 \
--static=1 \
--hostname=linux-web01 \
--name-servers="10.0.0.2" \
--kickstart=/var/lib/cobbler/kickstarts/Centos7.2-x86_64.cfg
system add # 添加定制系统
name # 定制系统名称
mac # mac地址
profile #指定profile
ip-address # 指定IP地址
subnet # 指定子网掩码
gateway # 指定网关
interface # 指定网卡,eth0上面配置已经修改,centos7默认网卡名称不是eth0
static # 1表示启用静态IP
hostname # 定义hostname
name-server # dns服务器
kickstart # 指定ks文件
配置成功后我们可以查看到刚才定制的系统
[root@localhost cobbler]# cobbler system list
linux-web01
接下来我们创建一个虚拟机,mac地址为00:0C:29:3B:03:9B,启动后你就会发现自动进入安装系统了,等安装完以后,所有的配置都和我们当初设置的一样。
7.使用koan实现重新安装系统
在客户端安装koan(要配置好源)
[root@localhost ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
[root@localhost ~]# yum install koan
查看cobbler上的配置文件
1 [root@localhost ~]# koan --server=10.0.0.101 --list=profiles
2 - looking for Cobbler at http://10.0.0.101:80/cobbler_api
3 Centos-7.2-x86_64
重新安装客户端系统
[root@localhost ~]# koan --replace-self --server=10.0.0.101 --profile=webserver1
重启系统后会自动重装系统
cobbler-web相关配置,后续文章再更。。。
参考文章:
http://www.cnblogs.com/liaojiafa/p/6445759.html
http://www.voidcn.com/article/p-dwdfkmfh-boa.html
http://werewolftj.blog.51cto.com/1606482/1673779
http://www.cnblogs.com/qige2017/p/7545812.html