cobbler-ks文件配置与自动安装

编辑 sample_end.ks
默认ks文件

/var/lib/cobbler/kickstarts/sample_end.ks

默认pxe启动文件

/var/lib/tftpboot/pxelinux.cfg/default

vim sample_end.ks
# This kickstart file should only be used with EL > 5 and/or Fedora > 7.
# For older versions please use the sample.ks kickstart file.

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel

# Use text mode install
text
# Firewall configuration
#firewall --disabled #防火墙与selinux是否开启
firewall --enabled
selinux --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
network  --device=enp4s0 --onboot=yes #开启双网口设备的第二个网口,第二个网卡是什么名称,device=就写什么名称
# Reboot after installation
reboot

#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  --utc Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
part /boot/efi --fstype="efi" --size 1024 --fsoptions="umask=0077,shortname=winnt" --ondisk=sda
part /boot --fstype="xfs" --size=1024 --ondisk=sda
part swap --fstype="swap" --size=8000 --ondisk=sda
part / --fstype="xfs" --size=19000 --grow --ondisk=sda

%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
nc
git
vim
wget
#sshpass
net-tools
bash-completion
python-setuptools
ntp

#$SNIPPET('func_install_if_enabled')
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post #安装完之后运行脚本,拷贝文件,安装软件
ln -s /usr/lib/systemd/system/supervisord.service /etc/systemd/system/multi-user.target.wants/supervisord.service
yum install -y sshpass 
sshpass -p 123456 scp -r -o StrictHostKeyChecking=no root@192.168.1.191:/root/depends /var/ 
/usr/bin/python2.7 /var/depends/get-pip.py  -i https://mirrors.aliyun.com/pypi/simple
/usr/bin/pip2.7 install gitpython
/usr/bin/pip2.7 install schedule
rpm -ivh /var/depends/python-meld3-0.6.10-1.el7.x86_64.rpm
rpm -ivh /var/depends/supervisor-3.4.0-1.el7.noarch.rpm
cp /var/depends/supervisord.conf /etc/
tar zxf /var/depends/pos_site.tar.gz -C /var/
tar zxf /var/depends/gtesra.tar.gz -C /var/
cp /var/depends/gupgrade.conf /etc/supervisord.d/
systemctl start supervisor.service
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

$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('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

cat /var/lib/tftpboot/pxelinux.cfg/default

DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io  #标题可修改
TIMEOUT 200   #超时时间
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-6.4-x86_64 #默认第一选项,选择CentOS-6.4-x86_64之后如无其他操作,将安装CentOS-6.4-x86_64系统,这里默认为local。
LABEL CentOS-6.4-x86_64
        MENU DEFAULT
        kernel /p_w_picpaths/CentOS-6.4-x86_64/vmlinuz
        MENU LABEL CentOS-6.4-x86_64
        append initrd=/p_w_picpaths/CentOS-6.4-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.100.20/cblr/svc/op/ks/profile/CentOS-6.4-x86_64
        ipappend 2
LABEL local
        MENU LABEL (local)
        LOCALBOOT 2 
MENU end
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值