Tuesday, October 15, 2013

Kikstart file for unattended install of ESXi 5.5

#
# Sample scripted installation file
#
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw mypassword
# Install on the first local disk available on machine
install --firstdisk --overwritevmfs
# Set the network to DHCP on the first network adapter
network --bootproto=dhcp --device=vmnic0
# A sample post-install script
%post --interpreter=python --ignorefailure=true
import time
stampFile = open('/finished.stamp', mode='w')
stampFile.write( time.asctime() )

Installation and Upgrade Script Commands

To modify the default installation or upgrade script or to create your own script, use supported commands.
Use supported commands in the installation script, which you specify with a boot command when you boot
the installer.
To determine which disk to install or upgrade ESXi on, the installation script requires one of the following
commands: install, upgrade, or installorupgrade. The install command creates the default partitions,
including a VMFS datastore that occupies all available space after the other partitions are created. The
install command replaces the autopart command that was used for scripted ESXi 4.1 installations.


accepteula or vmaccepteula (required)
Accepts the ESXi license agreement. This command functions as it did in ESXi 4.1.
clearpart (optional)
Compared to kickstart, the behavior of the ESXi clearpart command is different. Carefully edit the
clearpart command in your existing scripts.
Clears any existing partitions on the disk. Requires install command to be specified.
--drives= Remove partitions on the specified drives.
--alldrives Ignores the --drives= requirement and allows clearing of partitions on every
drive.
--ignoredrives= Removes partitions on all drives except those specified. Required unless the
--drives= or --alldrives flag is specified.
--overwritevmfs Permits overwriting of VMFS partitions on the specified drives. By default,
overwriting VMFS partitions is not allowed.
--firstdisk=
disk-type1
[disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to
the following order:
1 Locally attached storage (local)
2 Network storage (remote)
3 USB disks (usb)
You can change the order of the disks by using a comma separated list
appended to the argument. If you provide a filter list, the default settings are
overridden. You can combine filters to specify a particular disk, including
esx for the first disk with ESX installed on it, model and vendor information,
or the name of the vmkernel device driver. For example, to prefer a disk with
the model name ST3120814A and any disk that uses the mptsas driver rather
than a normal local disk, the argument is
--firstdisk=ST3120814A,mptsas,local.
dryrun (optional)
Parses and checks the installation script. Does not perform the installation.
install
Specifies that this is a fresh installation. Replaces the deprecated autopart command used for ESXi 4.1
scripted installations. Either the install, upgrade, or installorupgrade command is required to determine
which disk to install or upgrade ESXi on.
--disk= or --drive= Specifies the disk to partition. In the command --disk=diskname, the diskname
can be in any of the forms shown in the following examples:
n Path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0
n MPX name: --disk=mpx.vmhba1:C0:T0:L0
n VML name: --disk=vml.000000034211234


n vmkLUN UID: --disk=vmkLUN_UID
For accepted disk name formats, see “Disk Device Names,” on page 152.
--firstdisk=
disk-type1,
[disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to
the following order:
1 Locally attached storage (local)
2 Network storage (remote)
3 USB disks (usb)
You can change the order of the disks by using a comma separated list
appended to the argument. If you provide a filter list, the default settings are
overridden. You can combine filters to specify a particular disk, including
esx for the first disk with ESX installed on it, model and vendor information,
or the name of the vmkernel device driver. For example, to prefer a disk with
the model name ST3120814A and any disk that uses the mptsas driver rather
than a normal local disk, the argument is
--firstdisk=ST3120814A,mptsas,local.
--ignoressd Excludes solid-state disks (S--firstdiskSDs) from eligibility for
partitioning. This option can be used with the install command and the
--firstdisk option. This option takes precedence over the --firstdisk
option. This option is invalid with the --drive or --disk options and with
the upgrade and installorupgrade commands. See the vSphere Storage
documentation for more information about preventing SSD formatting
during auto-partitioning.
--overwritevsan You must use the --overwritevsan option when you install ESXi on a disk,
either SSD or HDD (magnetic), that is in a Virtual SAN disk group. If you use
this option and there is no Virtual SAN partition on the selected disk, the
installation will fail. When you install ESXi on a disk that is in Virtual SAN
disk group, the result depends on the disk you select:
n If you select an SSD, the SSD and all underlying HDDs in the same disk
group will be wiped.
n If you select an HDD, and the disk group size is greater than two, only
the selected HDD will be wiped.
n If you select an HDD disk, and the disk group size is two or less, the SSD
and the selected HDD will be wiped.
For more information about managing Virtual SAN disk groups, see the
vSphere Storage documentation.
--overwritevmfs Required to overwrite an existing VMFS datastore on the disk before
installation.
--preservevmfs Preserves an existing VMFS datastore on the disk during installation.
--novmfsondisk Prevents a VMFS partition from being created on this disk. Must be used
with --overwritevmfs if a VMFS partition already exists on the disk.
installorupgrade
Either the install, upgrade, or installorupgrade command is required to determine which disk to install or
upgrade ESXi on.
--disk= or --drive= Specifies the disk to partition. In the command --disk=diskname, the diskname
can be in any of the forms shown in the following examples:
n Path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0
n MPX name: --disk=mpx.vmhba1:C0:T0:L0
n VML name: --disk=vml.000000034211234
n vmkLUN UID: --disk=vmkLUN_UID
For accepted disk name formats, see “Disk Device Names,” on page 152.
--firstdisk=
disk-type1,
[disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to
the following order:
1 Locally attached storage (local)
2 Network storage (remote)
3 USB disks (usb)
You can change the order of the disks by using a comma separated list
appended to the argument. If you provide a filter list, the default settings are
overridden. You can combine filters to specify a particular disk, including
esx for the first disk with ESX installed on it, model and vendor information,
or the name of the vmkernel device driver. For example, to prefer a disk with
the model name ST3120814A and any disk that uses the mptsas driver rather
than a normal local disk, the argument is
--firstdisk=ST3120814A,mptsas,local.
--overwritevsan You must use the --overwritevsan option when you install ESXi on a disk,
either SSD or HDD (magnetic), that is in a Virtual SAN disk group. If you use
this option and there is no Virtual SAN partition on the selected disk, the
installation will fail. When you install ESXi on a disk that is in Virtual SAN
disk group, the result depends on the disk you select:
n If you select an SSD, the SSD and all underlying HDDs in the same disk
group will be wiped.
n If you select an HDD, and the disk group size is greater than two, only
the selected HDD will be wiped.
n If you select an HDD disk, and the disk group size is two or less, the SSD
and the selected HDD will be wiped.
For more information about managing Virtual SAN disk groups, see the
vSphere Storage documentation.
--overwritevmfs Install ESXi if a VMFS partition exists on the disk, but no ESX or ESXi
installation exists. Unless this option is present, the installer will fail if a
VMFS partition exists on the disk, but no ESX or ESXi installation exists.
--forcemigrate If a version 4.x host contains customizations, such as third-party VIBS or
drivers, that are not included in the installer .ISO, the installer exits with an
error describing the problem. The forcemigrate option overrides the error
and forces the upgrade.
If you are upgrading a 5.0.x host, supported custom VIBs on the host that are
not included in the ESXi installer ISO are migrated. If the host or the
installer .ISO contains a VIB that creates a conflict and prevents the upgrade,
an error message identifies the offending VIB. You can remove the VIB and
retry the upgrade, or use ESXI Image Builder to create a custom installer .ISO
that resolves the conflict. The forcemigrate option is not available.
See the vSphere Upgrade documentation for imformation about upgrading
hosts that have third-party custom VIBs.
keyboard (optional)
Sets the keyboard type for the system.
keyboardType Specifies the keyboard map for the selected keyboard type. keyboardType
must be one of the following types.
n Belgian
n Brazilian
n Croatian
n Czechoslovakian
n Danish
n Default
n Estonian
n Finnish
n French
n German
n Greek
n Icelandic
n Italian
n Japanese
n Latin American
n Norwegian
n Polish
n Portuguese
n Russian
n Slovenian
n Spanish
n Swedish
n Swiss French
n Swiss German
n Turkish
n US Dvorak
n Ukranian
n United Kingdom
serialnum or vmserialnum (optional)
Deprecated in ESXi 5.0.x. Supported in ESXi 5.1. Configures licensing. If not included, ESXi installs in
evaluation mode.
--esx=<license-key> Specifies the vSphere license key to use. The format is 5 five-character groups
(XXXXX-XXXXX-XXXXX-XXXXX-XXXXX).
network (optional)
Specify a network address for the system.
--bootproto=[dhcp|
static]
Specify whether to obtain the network settings from DHCP or set them
manually.
--device= Specifies either the MAC address of the network card or the device name, in
the form vmnicNN, as in vmnic0. This options refers to the uplink device for the
virtual switch.
--ip= Sets an IP address for the machine to be installed, in the form
xxx.xxx.xxx.xxx. Required with the --bootproto=static option and
ignored otherwise.
--gateway= Designates the default gateway as an IP address, in the form
xxx.xxx.xxx.xxx. Used with the --bootproto=static option.
--nameserver= Designates the primary name server as an IP address. Used with the --
bootproto=static option. Omit this option if you do not intend to use DNS.
The --nameserver option can accept two IP addresses. For example: --
nameserver="10.126.87.104[,10.126.87.120]"
--netmask= Specifies the subnet mask for the installed system, in the form
255.xxx.xxx.xxx. Used with the --bootproto=static option.
--hostname= Specifies the host name for the installed system.
--vlanid= vlanid Specifies which VLAN the system is on. Used with either the
--bootproto=dhcp or --bootproto=static option. Set to an integer from 1
to 4096.
--addvmportgroup=(0|1) Specifies whether to add the VM Network port group, which is used by
virtual machines. The default value is 1.
paranoid (optional)
Causes warning messages to interrupt the installation. If you omit this command, warning messages are
logged.
part or partition (optional)
Creates an additional VMFS datastore on the system. Only one datastore per disk can be created. Cannot be
used on the same disk as the install command. Only one partition can be specified per disk and it can only
be a VMFS partition
datastore name Specifies where the partition is to be mounted
--ondisk= or --ondrive= Specifies the disk or drive where the partition is created.
--firstdisk=
disk-type1,
[disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to
the following order:
1 Locally attached storage (local)
2 Network storage (remote)
3 USB disks (usb)
You can change the order of the disks by using a comma separated list
appended to the argument. If you provide a filter list, the default settings are
overridden. You can combine filters to specify a particular disk, including
esx for the first disk with ESX installed on it, model and vendor information,
or the name of the vmkernel device driver. For example, to prefer a disk with
the model name ST3120814A and any disk that uses the mptsas driver rather
than a normal local disk, the argument is
--firstdisk=ST3120814A,mptsas,local.
reboot (optional)
Reboots the machine after the scripted installation is complete.
<--noeject> The CD is not ejected after the installation.
rootpw (required)
Sets the root password for the system.
--iscrypted Specifies that the password is encrypted.
password Specifies the password value.
upgrade
Either the install, upgrade, or installorupgrade command is required to determine which disk to install or
upgrade ESXi on.
--disk= or --drive= Specifies the disk to partition. In the command --disk=diskname, the diskname
can be in any of the forms shown in the following examples:
n Path: --disk=/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0
n MPX name: --disk=mpx.vmhba1:C0:T0:L0
n VML name: --disk=vml.000000034211234
n vmkLUN UID:--disk=vmkLUN_UID
For accepted disk name formats, see “Disk Device Names,” on page 152.
--firstdisk=
disk-type1,
[disk-type2,...]
Partitions the first eligible disk found. By default, the eligible disks are set to
the following order:
1 Locally attached storage (local)
2 Network storage (remote)
3 USB disks (usb)
You can change the order of the disks by using a comma separated list
appended to the argument. If you provide a filter list, the default settings are
overridden. You can combine filters to specify a particular disk, including
esx for the first disk with ESX installed on it, model and vendor information,
or the name of the vmkernel device driver. For example, to prefer a disk with
the model name ST3120814A and any disk that uses the mptsas driver rather
than a normal local disk, the argument is
--firstdisk=ST3120814A,mptsas,local.
--deletecosvmdk If the system is being upgraded from ESX, remove the directory that contains
the old Service Console VMDK file, cos.vmdk, to reclaim unused space in the
VMFS datastore.
--forcemigrate If a version 4.x host contains customizations, such as third-party VIBS or
drivers, that are not included in the installer .ISO, the installer exits with an
error describing the problem. The forcemigrate option overrides the error
and forces the upgrade. If you are upgrading a 5.0.x host, supported custom
VIBs that are not included in the ESXi installer ISO are migrated. You do not
need to to use the forcemigrate option.
See the vSphere Upgrade documentation for imformation about upgrading
hosts that have third-party custom VIBs.
CAUTION Using the forcemigrate option might cause the upgraded host to
not boot properly, to exhibit system instability, or to lose functionality.
%include or include (optional)
Specifies another installation script to parse. This command is treated similarly to a multiline command, but
takes only one argument.
filename For example: %include part.cfg
%pre (optional)
Specifies a script to run before the kickstart configuration is evaluated. For example, you can use it to
generate files for the kickstart file to include.
--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.
%post (optional)
Runs the specified script after package installation is complete. If you specify multiple %post sections, they
run in the order that they appear in the installation script.
--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.
--timeout=secs Specifies a timeout for running the script. If the script is not finished when
the timeout expires, the script is forcefully terminated.
--ignorefailure If true, the installation is considered a success even if the %post script
terminated with an error.
=[true|false]
%firstboot
Creates an init script that runs only during the first boot. The script has no effect on subsequent boots. If
multiple %firstboot sections are specified, they run in the order that they appear in the kickstart file.
NOTE You cannot check the semantics of %firstboot scripts until the system is booting for the first time. A
%firstboot script might contain potentially catastrophic errors that are not exposed until after the
installation is complete.
--interpreter
=[python|busybox]
Specifies an interpreter to use. The default is busybox.
NOTE You cannot check the semantics of the %firstboot script until the system boots for the first time. If the
script contains errors, they are not exposed until after the installation is complete.
Differences Between ESXi 4.x and ESXi 5.x Scripted Installation and Upgrade
Commands
Before you perform a scripted ESXi installation or upgrade, if you are familiar with ESXi version 4.x scripted
installation, note the differences between ESXi 4.x and ESXi 5.x scripted installation and upgrade
commands.
In ESXi 5.x, because the installation image is loaded directly into the host RAM when the host boots, you do
not need to include the location of the installation media in the installation script.
ESXi 5.x supports scripted upgrades in addition to scripted installation.
Command differences are noted in the following summary.
accepteula or
vmaccepteula
Only in ESXi
autopart Deprecated and replaced with install, upgrade, or installorupgrade.
auth or authconfig Not supported in ESXi 5.x.
bootloader Not supported in ESXi 5.x.
esxlocation Deprecated and unused in ESXi.
firewall Not supported in ESXi 5.x.
firewallport Not supported in ESXi 5.x.
install,
installorupgrade,
upgrade
These commands replace the deprecated autopart command. Use one of
these command to specify the disk to partition, and the part command to
create the vmfs datastore. installorupgrade and upgrade are newly
supported in ESXi 5.x.
serialnum Deprecated in ESXi 5.0.x. Supported in ESXi 5.1.
vmserialnum Deprecated in ESXi 5.0.x. Supported in ESXi 5.1.
timezone Not supported in ESXi 5.x.
virtualdisk Not supported in ESXi 5.x.
zerombr Not supported in ESXi 5.x.
%firstboot --level option not supported in ESXi 5.x.
%packages Not supported in ESXi 5.x.
Disk Device Names
The install, upgrade, and installorupgrade installation script commands require the use of disk device
names.
Table 7‑3. Disk Device Names
Format Examples Description
VML vml.00025261 The device name as reported by
the vmkernel
MPX mpx.vmhba0:C0:T0:L0 The device name
NOTE When you perform a scripted upgrade from ESX 4.x to ESXi 5.x, the MPX and VML disk names
change, which might cause the upgrade to fail. To avoid this problem, use Network Address Authority
Identifiers (NAA IDs) for the disk device instead of MPX and VML disk names.
After you obtain the NAA ID or VML number, typically from the BIOS of the storage adapter, you can
modify the kickstart file (ks.cfg) for each host to identify the disk device by the NAA ID or VML number.
Some devices do not provide an NAA ID. In these circumstances, an MPX Identifier is generated by ESXi to
represent the LUN or disk. The identifier takes a form similar to the canonical name of previous versions of
ESXi with the mpx. prefix. This identifier can be used exactly as the NAA ID. See Knowledge Base article
1014953.

No comments:

Post a Comment