IPXE搭建底层装机系统

IPXE 开发

1: 上报安装进度
curl http://localhost:8083/api/osinstall/v1/report/deviceInstallLog -X POST -d '{"Sn":"xxxxxxx","Title":"dwasd","InstallProgres":0.4}'
2: 生成MAC 文件
curl http://localhost:8083/api/osinstall/v1/device/createIpxeConfig -X POST -d '{"Sn":"xxxxxx","OsVersion":"bms_centos7.5-x86_64_Base"}'
3: 增加机器
curl http://localhost:8083/api/osinstall/v1/machine/newadd -X POST -d '{"Sn":"xxxxxx","Mac":"68:05:CA:A2:5F:B8,68:05:CA:A2:5F:B9"}'
4: 查询机器
curl http://localhost:8083/api/osinstall/v1/machine/newlist -X POST -d '{"Sn":"xxxxxx"}'

1:数据库维护,
2:

待定
5: 接收参数
curl http://100.71.70.47:8083/api/osinstall/v1/device/parameter -X POST -d '{"Sn":"xxxxxxx","IP":"192.168.3.10"}'

6: 生成OS配置文件

DROP TABLE IF EXISTS new_macs;
CREATE TABLE new_macs ( id int(11) unsigned NOT NULL AUTO_INCREMENT,created_at timestamp NULL DEFAULT NULL,deleted_at timestamp NULL DEFAULT NULL,updated_at timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, sn varchar(255) NOT NULL, mac varchar(512) NOT NULL, status varchar(255) NOT NULL, installProgres float NULL, PRIMARY KEY (id),UNIQUE KEY sn (sn)) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

insert INTO new_macs (created_at,updated_at,sn,mac,status,installProgres) values(NOW(),NOW(),"xxxxxxxx","68:05:CA:A2:5F:B8,68:05:CA:A2:5F:B9,68:05:CA:A2:6D:E8,68:05:CA:A2:6D:E9","stat",0);

insert INTO os_configs (id,created_at,updated_at,deleted_at,name,pxe) values("17",NOW(),NOW(),NULL,"bms_centos7.5-x86_64_Base","#!ipxe
kernel http://30.138.250.65/centos7.5/images/pxeboot/vmlinuz initrd=initrd.img ksdevice=bootif ks=http://30.138.250.65/centos7.5/ks.cfg console=tty0 selinux=0 net.ifnames=0 biosdevname=0
initrd http://30.138.250.65/centos7.5/images/pxeboot/initrd.img
boot
");

make bin-x86_64-efi/ipxe.efi EMBED=uefi.ipxe
#!ipxe
dhcp
chain pxelinux.cfg/01-${netX/mac:hexhyp}
#iset ${pxelinux.cfg/01-${netX/mac:hexhyp}} && chain ${pxelinux.cfg/01-${netX/mac:hexhyp}} || chain pxelinux.cfg/default_uefi

#!ipxe
kernel http://192.168.255.133/centos/7.5/os/x86_64/images/pxeboot/vmlinuz initrd=initrd.img ksdevice=bootif ks=http://192.168.255.133/centos/ks.cfg console=tty0 selinux=0 net.ifnames=0 biosdevname=0
initrd http://192.168.255.133/centos/7.5/os/x86_64/images/pxeboot/initrd.img
boot

tftp
https://www.cnblogs.com/miaocbin/p/11314702.html

猜你喜欢

转载自blog.51cto.com/12768454/2497733