VMware Cloud Community
kac2
Expert
Expert

Getting a kick script beyond the basics to work

Hey everyone,

First off, I'm novice when it comes to scripting and kick scripts.

I'm trying to create a kickscript that incorporates a bunch of stuff. Currently, I have a semi-simple kick script, but it doesn't completely finish. I'm trying to run this against a virtual ESXi VM with 4 NICs

**START**

rootpw changeme

install url http://192.168.187.66/ESXi

autopart --firstdisk --overwritevmfs

reboot

#Network install type

network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=192.168.187.160 --netmask=255.255.255.0 --gateway=192.168.187.1 --nameserver=192.168.3.2 --hostname=ESXi02.local

vmaccepteula

%firstboot --unsupported --interpreter=busybox

#Add vMotion Portgroup to vSwitch0

esxcfg-vswitch -A vMotion vSwitch0

#Add pNIC vmnic3 to vSwitch0

esxcfg-vswitch -L vmnic3 vSwitch0

#Assign ip address to vMotion vmk1

esxcfg-vmknic -a -i 192.168.187.161 -n 255.255.255.0 -p vMotion

vim-cmd hostsvc/vmotion/vnic_set vmk1

#Set DNS

vim-cmd hostsvc/net/dns_set --ip-addresses=192.168.3.2,192.168.3.23

#Set NIC order policy for port groups

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic0 --nicorderpolicy-standby=vmnic3 vSwitch0 'Management Network'"

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic3 --nicorderpolicy-standby=vmnic0 vSwitch0 'vMotion'"

*FOR SOME REASON THE SCRIPT ENDS HERE**

#Add new vSwitch for IP Storage

esxcfg-vswitch -a vSwitch_IP-SAN

#Add port group for IP Storage Switch

esxcfg-vswitch -A NetApp_FAS2020A vSwitch_IP-SAN

#Add NICs to to new vSwitch

esxcfg-vswitch -L vmnic1 vSwitch_IP-SAN

esxcfg-vswitch -L vmnic2 vSwitch_IP-SAN

#Assign IP address to vmknic

esxcfg-vmknic -a -i 192.168.187.162 -n 255.255.255.0 NetApp_FAS2020a

#Add datastores

esxcfg-nas -a -o 192.168.52.101 -s /FAS2020a_Node1_NFS_A

esxcfg-nas -a -o 192.168.52.101 -s /FAS2020a_Node1_NFS_B

esxcfg-nas -a -o 192.168.52.102 -s /FAS2020a_Node2_NFS_A

grep ^admins: /etc/group > /dev/null || groupadd admins

useradd -g admins kac

echo password | passwd --stdin kac

%post --unsupported --interpreter=busybox

  1. Set NFS advanced Configuration Settings

/usr/sbin/esxcfg-advcfg -s 30 /Net/TcpipHeapSize

/usr/sbin/esxcfg-advcfg -s 120 /Net/TcpipHeapMax

/usr/sbin/esxcfg-advcfg -s 10 /NFS/HeartbeatMaxFailures

/usr/sbin/esxcfg-advcfg -s 12 /NFS/HeartbeatFrequency

/usr/sbin/esxcfg-advcfg -s 5 /NFS/HeartbeatTimeout

/usr/sbin/esxcfg-advcfg -s 64 /NFS/MaxVolumes

**END**

From the point of **FOR SOME REASON THE SCRIPT ENDS HERE** nothing else is set. If I go to the console screen of the ESXi host and I enable Local Tech Support mode and restart the management agents then this part of the script kicks in and works:

#Add new vSwitch for IP Storage

esxcfg-vswitch -a vSwitch_IP-SAN

#Add port group for IP Storage Switch

esxcfg-vswitch -A NetApp_FAS2020A vSwitch_IP-SAN

#Add NICs to to new vSwitch

esxcfg-vswitch -L vmnic1 vSwitch_IP-SAN

esxcfg-vswitch -L vmnic2 vSwitch_IP-SAN

but then nothing else is done. The vmknic for the storage isn't added or configured, advanced settings aren't put in, the users aren't added, etc. I have a lot more I want to add to the script, but I need the basics to work for now. I don't understand why after I enable local tech support mode, the storage vSwitch is then built. Any insights would be appreciated..

Thanks

0 Kudos
1 Reply
kac2
Expert
Expert

I mistyped where the script actually ends.

It ends after:

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic0 --nicorderpolicy-standby=vmnic3 vSwitch0 'Management Network'"

the next line about setting the order policy for the vMotion port group does NOT work.

Also, the

vim-cmd hostsvc/vmotion/vnic_set vmk1

doesn't work as well to set that as vMotion.

sorry!

0 Kudos