lang en_US.UTF-8 install url --url http://10.1.1.1/esx3 text langsupport --default en_US.UTF-8 keyboard de-latin1-nodeadkeys mouse genericwheelps/2 --device psaux #skipx vmaccepteula reboot network --device eth0 --bootproto dhcp --hostname=%#!computer@right(name,15)% --addvmportgroup=1 --vlanid=0 rootpw entercleartextpasswordhere firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc Europe/Berlin bootloader --location=mbr # here should partitions be imported clearpart --exceptvmfs part /boot --fstype ext3 --size=100 --ondisk=sda --asprimary part / --fstype ext3 --size=5000 --ondisk=sda --asprimary part swap --size=1024 --ondisk=sda --asprimary part /var/log --fstype ext3 --size=2048 --ondisk=sda part /tmp --fstype ext3 --size=2048 --ondisk=sda part None --size 100 --fstype vmkcore --ondisk sda %packages grub %post ############################# # install altiris agent ############################# cat > /tmp/install-adlagent.sh << EOF1 #!/bin/bash sleep 2 cd /tmp/ddp/ mkdir /mnt/ddp echo "Disabling Firewall" chkconfig firewall --level 2345 off /usr/sbin/esxcfg-firewall --AllowIncoming /usr/sbin/esxcfg-firewall --AllowOutgoing echo "MOUNTING EXPRESS SHARE" mount -t smbfs -o username=thisshareuser,password=thisparssword,ip=10.1.1.1 //altserver001/express /mnt/ddp rm -rf /usr/src/adlagent mkdir /usr/src/adlagent echo "Copying ADLAgent" cp -f /mnt/ddp/deplmes/deploy/post-os/esx3/altiris-adlagent-2.6-29.i386.bin /usr/src/adlagent/altiris-adlagent-2.6-29.i386.bin chmod 755 /usr/src/adlagent/altiris-adlagent-2.6-29.i386.bin /usr/src/adlagent/altiris-adlagent-2.6-29.i386.bin echo "Copying ADLAgent Config File" cp -f /mnt/ddp/deplmes/deploy/post-os/esx3/adlagent.conf /usr/src/adlagent/adlagent.conf cp -f /usr/src/adlagent/adlagent.conf /opt/altiris/deployment/adlagent/conf/adlagent.conf umount /mnt/ddp rmdir /mnt/ddp echo "Enabling Firewall" chkconfig firewall --level 2345 off #/usr/sbin/esxcfg-firewall --BlockIncoming #/usr/sbin/esxcfg-firewall --BlockOutgoing esxcfg-firewall --openPort 402,tcp,out,adlagent esxcfg-firewall --openPort 40200,tcp,out,adlagentFileTransfer service adlagent stop EOF1 chmod 755 /tmp/install-adlagent.sh ############################# # basic configuration tasks ############################# cat > /tmp/basic-config.sh << EOF2 #!/bin/bash sleep 2 # configure DNS echo nameserver nameserverip > /etc/resolv.conf echo nameserver nameserverip >> /etc/resolv.conf echo search mesmgt.loc >> /etc/resolv.conf # WARNING: This is not the most secure course of action! cp -f /etc/ssh/sshd_config /etc/ssh/sshd_config.old sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config.old > /etc/ssh/sshd_config service sshd restart EOF2 chmod 755 /tmp/basic-config.sh ############################# # configure vm network ############################# cat > /tmp/vm-network.sh << EOF2 #!/bin/bash sleep 2 #!/bin/bash # set nic speed esxcfg-nics -s 1000 -d full vmnic0 esxcfg-nics -s 1000 -d full vmnic1 esxcfg-nics -s 1000 -d full vmnic2 esxcfg-nics -s 1000 -d full vmnic3 esxcfg-nics -s 100 -d full vmnic4 esxcfg-nics -s 100 -d full vmnic5 # configure vswitches esxcfg-vswitch --link=vmnic1 vSwitch0 esxcfg-vswitch --add vSwitch1 esxcfg-vswitch --add-pg=serviceconsole vSwitch1 esxcfg-vswitch --link=vmnic4 vSwitch1 esxcfg-vswitch --link=vmnic5 vSwitch1 esxcfg-vswitch --add vSwitch2 esxcfg-vswitch --add-pg=vmotion vSwitch2 esxcfg-vswitch --link=vmnic2 vSwitch2 esxcfg-vswitch --link=vmnic3 vSwitch2 vimsh -n -e "/hostsvc/net/vswitch_setnumports vSwitch0 128" vimsh -n -e "/hostsvc/net/vswitch_setnumports vSwitch1 128" vimsh -n -e "/hostsvc/net/vswitch_setnumports vSwitch2 64" # set new serviceconsole ip settings esxcfg-vswif --add -i %NIC1IPADDR% -n %NIC1IPNETMASK% -p serviceconsole vswif1 echo GATEWAY=%NIC1IPGATEWAY% >> /etc/sysconfig/network-scripts/ifcfg-vswif1 cp -f /etc/sysconfig/network /etc/sysconfig/network.old sed -e 's/GATEWAYDEV=vswif0/GATEWAYDEV=vswif1/' /etc/sysconfig/network.old > /etc/sysconfig/network # set vmkernel ip settings esxcfg-vmknic --add --ip %#!computer@lic_os_key% --netmask 255.255.255.0 vmotion esxcfg-route 192.168.2.1 vmotion # deaktivate SC original esxcfg-vswif --disable vswif0 esxcfg-vswif --del vswif0 esxcfg-vswitch --del-pg="Service Console" vSwitch0 esxcfg-vswitch --del-pg="VM Network" vSwitch0 esxcfg-vswitch --add-pg="serverlan" vSwitch0 route add default gw %NIC1IPGATEWAY% service mgmt-vmware restart sleep 20 #### ## set teaming #### # vSwitch0 vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-policy failover_explicit vSwitch0" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-notify-switch true vSwitch0" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-active vmnic0 vSwitch0" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby vmnic1 vSwitch0" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-rollingorder false vSwitch0" # vSwitch1 vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-policy failover_explicit vSwitch1" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-notify-switch true vSwitch1" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-active vmnic4 vSwitch1" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby vmnic5 vSwitch1" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-rollingorder false vSwitch1" # vSwitch2 vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-policy failover_explicit vSwitch2" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-notify-switch true vSwitch2" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-active vmnic2 vSwitch2" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby vmnic3 vSwitch2" vimsh -n -e "hostsvc/net/vswitch_setpolicy --nicteaming-rollingorder false vSwitch2" # restart altiris agent #service adlagent restart EOF2 chmod 755 /tmp/vm-network.sh ################################## # perform configuration at reboot ################################## cp -f /etc/rc.d/rc.local /etc/rc.d/rc.local.old # add /tmp/install-adlagent.sh and basic-config.sh to rc.local cat >> /etc/rc.d/rc.local < /etc/rc.d/rc.local EOF3