1、openstack Icehouse版本ks文件
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
#clearpart --linux --drives=sda
#ignoredisk --only-use=sda #ignore more disk
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disable
# 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')
# Reboot after installation
reboot
#Root password
rootpw 369cloud
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone --utc Asia/Shanghai
# Install OS instead of upgrade
install
key --skip
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
part /boot --fstype=ext4 --size=200
part swap --size=32000
part / --fstype=ext4 --size=220000
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%packages --ignoremissing
@core
%post
Adding an SSH key to authorized keys
$SNIPPET('adding_an_ssh_key')
$SNIPPET('log_ks_post')
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('download_config_files')
$SNIPPET('cobbler_register')
$SNIPPET('post_anamon')
$SNIPPET('kickstart_done')
$SNIPPET('my_add_command_rhle_6.5_369cloud')
%end
2、ks文件中调用的snippt文件my_add_command_rhle_6.5_369cloud的配置
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
cat >/etc/yum.repos.d/os-icehouse.repo <<-EOF
[os-icehouse]
name=os-icehouse
baseurl=http://172.16.5.200:8080/os-icehouse
priority=1
enabled=1
gpgcheck=0
EOF
cat >/etc/hosts <<-EOF
172.16.7.1 369cloud-os-node1
172.16.7.2 369cloud-os-node2
172.16.7.3 369cloud-os-node3
172.16.7.4 369cloud-os-node4
172.16.7.5 369cloud-os-node5
172.16.7.6 369cloud-os-node6
172.16.7.7 369cloud-os-node7
172.16.7.8 369cloud-os-node8
172.16.7.9 369cloud-os-node9
172.16.7.10 369cloud-os-node10
EOF
echo "*/30 * * * * ntpdate 172.16.5.200" >> /var/spool/cron/root
mkdir /root/.ssh/
chmod 700 /root/.ssh/
cat >/root/.ssh/config <<-EOF
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR
EOF
chmod 600 /root/.ssh/config
cat >/root/.ssh/id_rsa <<-EOF
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEA159xWLESQKxo7xm2iN5Gs//YXvOX6H4pcZJnCgc53vT4I4Di
h3SdnS7g33WezkzNjasuzuiflWB7XkPnCHWMP2LpshY7MAjMtgfv3t4Lo7W4zlhh
IgrynJbzPCFMgLQhCAzOzgOPgV/szPA0ydka82Mo9eScUnzLOuVFYEjCKe2g/TVL
mmfIgMtE4bI3G6df8BNH+9g/L5id/fWT+FUMjVX0gMWgd3Q9xi984WJaQKQu+y60
tt1s38P/5xA1+ly7jN8MgJeHTRt//Xa61g7n5qWd1z29HJObmT2KbvuWyZXxYJLd
KyWcfIRxPY7hursIBHtEmvGnaau/gD4XLe7QlwIBIwKCAQAYpIH7gfN1GwStnInj
waGuK942vMDnXuAqPJ4Pxk/BtZizmbN9MeYgl6Sr0u2T64U0wxtK2MHH7cT01I9u
rlkr0MpAPQ4UHkNIAOg2ukp5HBUe5YdxmtnmAp90lhdfKoduomDHFlmLIOfc6ECM
GM/hTSlArGmjBvKnpSyACFC0VXZJ4ZM1t/hQ4Ozsu23YFifuTC6hm3nvM+hwMSfV
Wu9kllgU2PeBOvUtmORcs9p4Drfs+N9AaOA72iRad7t6kyeXU0o9TUPzwcwCICtO
h+ez9aGmB2DZOB2FxHL3gpitVa065qGvC830u8rt68vA8VTwqhN7WjqZCBOLka++
0kmLAoGBAO8c5J74jmzKv79oUgcmYf6jfyA2cwKrbZMaXgs8ouufkKZRLlzqxF5f
ZXd1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YDFzWE0mSJdwaWzqQ==
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA159xWLESQKxo7xm2iN5Gs//YXvOX6H4pcZJnCgc53vT4I4Dih3SdnS7g33WezkzNjasuzuiflWB7XkPnCHWMP2LpshY7MAjMtgfv3t4Lo7W4zlhhIgrynJbzPCFMgLQhCAzOzgOPgV/szPA0ydka82Mo9eScUnzLOuVFYEjCKe2g/TVLmmfIgMtE4bI3G6df8BNH+9g/L5id/fWT+FUMjVX0gMWgd3Q9xi984WJaQKQu+y60tt1s38P/5xA1+ly7jN8MgJeHTRt//Xa61g7n5qWd1z29HJObmT2KbvuWyZXxYJLdKyWcfIRxPY7hursIBHtEmvGnaau/gD4XLe7Qlw== root@bgw-os-node152
EOF
chmod 600 /root/.ssh/id_rsa
chmod 600 /root/.ssh/authorized_keys
useradd nova -U -d /var/lib/nova
mkdir -p /var/lib/nova/.ssh/
chmod 700 /var/lib/nova/.ssh/
cat >/var/lib/nova/.ssh/config <<-EOF
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR
EOF
cat > /var/lib/nova/.ssh/id_rsa <<-EOF
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEAmIirl1+g+OIfOv+GUMblm3sPvqtH0qnbnKnlQLJk8LUeMdmG
/zxVMyrz2AwlC7dVA9QaAPNBniP8Rt3jzCH9QQfWe2ufb7Ic8Hkl8/2Y2VXmwvJ7
YoCS25EdkGcTuNuruX+W6DGLuNSEL1vZxQFuctHMIza8z8GIuyfODgypblk6DWHN
NuJTDLAn9eEp1fmE2jl2RjLoFNKuiOmQxGQfrxW6U66cDQzXKV5ZQ43OonR8DjXu
bSdSR9vgkI7lVsvoMu7ydb9wRha+68OdvPHEFEPZd6TRFNAlNzzCPum9M0CPUoZg
eEylgSkwRvJddROnR0/BwzxsLvMOMhkTlYrwPQIBIwKCAQBomDsl+G5hhRy6vdhx
53jfpNeYr/a8VzeBXo6Sw3hqitLgWqW2VUG8r70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zYaM6AT95WB7GdM4r9GntuVnQDjZzldGJaTX4ngsb02uzAYlpNzgzJ0iIv577Hc
i2TgUz82++bSKP0L3rLiRiVGE53fszFna2IKQVTuB+LUQSRoMQ==
-----END RSA PRIVATE KEY-----
EOF
cat >/var/lib/nova/.ssh/authorized_keys <<-EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCwww24e5eBdcNAFIYL/4LJ54eH5XQr1GmpuRB4m7NAcsC7PTt2BDob2P5bt+Rg1o64Aah2m1ajt3kIewEeVCKIC6Msocu4W2ERD893aVgo72Dn9+ogPpg7w/GA4GKyXg2DS4mCNPN8pLQa1wxrozyIFqyyNYDFzWE0mSJdwaWzqQ==
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAmIirl1+g+OIfOv+GUMblm3sPvqtH0qnbnKnlQLJk8LUeMdmG/zxVMyrz2AwlC7dVA9QaAPNBniP8Rt3jzCH9QQfWe2ufb7Ic8Hkl8/2Y2VXmwvJ7YoCS25EdkGcTuNuruX+W6DGLuNSEL1vZxQFuctHMIza8z8GIuyfODgypblk6DWHNNuJTDLAn9eEp1fmE2jl2RjLoFNKuiOmQxGQfrxW6U66cDQzXKV5ZQ43OonR8DjXubSdSR9vgkI7lVsvoMu7ydb9wRha+68OdvPHEFEPZd6TRFNAlNzzCPum9M0CPUoZgeEylgSkwRvJddROnR0/BwzxsLvMOMhkTlYrwPQ== nova@369cloud-os-node3
EOF
chmod 600 /var/lib/nova/.ssh/id_rsa
chmod 600 /var/lib/nova/.ssh/authorized_keys
chmod 600 /var/lib/nova/.ssh/config
chown nova:nova /var/lib/nova -R
yum clean all
sed -i 's/BOOTPROTO="dhcp"/BOOTPROTO="none"/g' /etc/sysconfig/network-scripts/ifcfg-eth1
sed -i 's/ONBOOT="no"/ONBOOT="yes"/g' /etc/sysconfig/network-scripts/ifcfg-eth1
yum install kernel-ml -y
sleep 120
sed -i '/default/s/1/0/' /boot/grub/grub.conf
sleep 30
reboot