资源池节点主机扩容流程
一、工作内容及顺序
- 主机组与网络组需根据项目实施规划进行KS脚本编写与交换机配置编写,在编写完之后转交给一级项目经理进行审核
- 到达现场后需要对交换机与服务器进行验收,通过跑脚本的方式来对机器进行检测,如发现配置与厂商所需设定的配置有出入,则需要联系厂商人员到达现场进行调整。不可自行调整
- 服务器操作系统均为Centos版本,需要根据实施规范来对版本进行调整。如一些项目中需要推送自研Ctyun
- 在网络组搭建好基础网络之后,主机组需要在接入交换机进行推送,其中需要开通特定推送Vlan。通过网络获取DHCP之后进行批量推机
- 成功推机之后,需要对主机内核进行升级(也可以直接通过ks直接升级),如果不能直接升级,则需要通过带外使用ebox进行批量脚本运行
- 进行各类检查
- 对项目进行割接测试,保证割接业务无异常影响
- 攥写交付文档
二、KS详细解读
install
url --url=ftp://172.16.10.10/centos7.9
lang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us'
rootpw --plaintext 'Ctyun.cn123'
firewall --disabled
auth --enableshadow --passalgo=sha512
selinux --disabled
clearpart --all --initlabel
part /boot --fstype="xfs" --ondisk=sda --size=1024
part / --fstype="xfs" --ondisk=sda --grow
%packages --ignoremissing
@^minimal
@core
wget
lldpad
ipmitool
%end
%pre
%end
%post
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop libvirtd.service
systemctl disable libvirtd.service
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start lldpd.service
systemctl enable lldpd.service
sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
for i in 'ls /sys/class/net/ | grep e';
do
cat >/etc/sysconfig/network-scripts/ifcfg-$i << EOF
DEVICE=$i
TYPE=Ethernet
NAME=$i
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
EOF
done
%end
%post
sed -i -e "s/^#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
curl ftp://172.16.10.10/scripts/config-ip-server1.sh >> /tmp/config-ip-server1.sh
curl ftp://172.16.10.10/scripts/ip2.txt >> /tmp/ip2.txt
chmod +x /tmp/config-ip-server1.sh
sh /tmp/config-ip-server1.sh
三、配置IP脚本解读
#!/bin/bash
cp /etc/sysconfig/network /root/network_`date +%Y%m%d%H_%H%M%s`
v_serial=`dmidecode -s system-serial-number | tail -n 1` 2>> /root/out.txt
v_line=`wc -l /tmp/ip2.txt | awk '{print $1}'` 2>> /root/out.txt
NETWORK="/etc/sysconfig/network" 2>> /root/out.txt
let "v_line+=1" 2>> /root/out.txt
for((i=1;i<$v_line;i++));
do
v_ip_serial=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 1` 2>> /root/out.txt
if [ "$v_serial" = "$v_ip_serial" ];then
v_host=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 2` 2>> /root/out.txt
v_ip1=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 3` 2>> /root/out.txt
v_netmask1=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 4` 2>> /root/out.txt
v_getway1=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 5` 2>> /root/out.txt
v_ip2=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 6` 2>> /root/out.txt
v_netmask2=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 7` 2>> /root/out.txt
v_ip3=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 8` 2>> /root/out.txt
v_netmask3=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 9` 2>> /root/out.txt
v_ip4=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 10` 2>> /root/out.txt
v_netmask4=`cat /tmp/ip2.txt | head -n $i | tail -n 1 | cut -d '|' -f 11` 2>> /root/out.txt
fi
done
cat > /etc/sysconfig/network-scripts/ifcfg-enp59s0f0 <<EOF
DEVICE=enp59s0f0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond1
SLAVE=yes
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-enp176s0f0 <<EOF
DEVICE=enp176s0f0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond1
SLAVE=yes
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-bond1 <<EOF
DEVICE=bond1
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=yes
BONDING_MASTER=yes
BONDING_OPTS="miimon=100 mode=6"
IPADDR=$v_ip1
NETMASK=$v_netmask1
GATEWAY=$v_getway1
EOF
echo $v_host > /etc/hostname
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl restart network
四、序列号文件编写
- 从实施规划中找到主机设备规划
- 将序列号、主机名、业务ip、计算、存储提取出,复制到一个新的excel表中,每一行和每一行之间使用“|” 隔开
- 然后将内容复制粘贴至notepad++中进行编辑,将“|”两侧的空行进行替换删除
- 将该内容放入pxe系统中,之后进行导入