So how does the VIB Author tool work?
VIB Author is distributed only as an RPM and you will need to install the VIB Author tool on a 32-bit Linux system (sorry, no 64-bit support). In my home setup, I went with CentOS 6.2 i386 as it was free to download & easy to setup or you may choose go with SUSE Linux Enterprise 11 SP2 which is the recommended platform per the documentation.
To install the RPM, run the following command:
rpm -ivh vmware-esx-vib-author-5.0.0-0.0.844296.i386.rpmIn the example below, I will show you how to create a custom VIB that contains several different configurations:
- Custom Firewall Rule
- Custom Startup script (adds a static route)
- Custom Files (ghettoVCB)
Here is the directory structure for the example that we will be going through:
Step 1 - Create your stage directory structure which we will then populate with your payload files as well as the descriptor.xml file.
mkdir -p stage/payloads/payload1Step 2 - Create your descriptor.xml file which should be placed in the stage directory. For more details on the parameters within the descriptor.xml, please take a look at the documentation.
Here is an example of my descriptor.xml file:
Step 3 - Create the directory structure and store the files you wish to include under payload1. Ensure the the directory structure matches the absolute path of how you want the files to appear on the ESXi host. For example, if you wish to create a file call foo in /etc/vmware/foo then your directory structure should look like stage/payloads/payload1/etc/vmware/foo
Note: In the documentation, there is a list of default supported paths, if you venture off of this supported list, then you will need to issue the -f flag when creating your VIB as well as installing your VIB on your ESXi host
So for our examples we have the following files:
This one should be pretty straight forward, we are just creating a custom ESXi firewall rule and you will need to place your configuration file under /etc/vmware/firewall, please take a look at this article for more details on creating your own firewall rules.
This is a custom shell script that adds a static route to an ESXi host upon bootup under /etc/rc.local.d. There maybe other startup scripts that could be executed and you do not want to conflict with any system defaults. I recommend you label yours with a high number such as 999 to ensure it is one of the last scripts to execute.
This is a custom set of files that I would like to store in ESXi under /opt directory and the files are my free ghettoVCB backup script.
Here is a copy of my directory structure (stage.zip) which can be used as a reference.
Step 4 - Now we ready to create our VIB and/or offline bundle by specifying our stage directory as input. In this example, we will generate both a VIB as well as an offline bundle containing the same contents. Run the following command:
vibauthor -C -t stage -v virtuallyghetto.vib -O virtuallyghetto-offline-bundle.zip -fNote: Since we added some files outside of the default supported paths, we also need to specify the -f flag to force the creation.
vibauthor -i -v virtuallyghetto.vib
To install VIB run the following command:
esxcli software vib install -v /vmfs/volumes/[datastore-name]/virtuallyghetto.vib -fTo install the offline bundle run the following command:
esxcli software vib install -d /vmfs/volumes/[datastore-name]/virtuallyghetto-offline-bundle.zip -fNote: You need to specify the -f flag to force the installation since we created files in an unsupported path. I have been able to test the VIB and offline bundle installation on both ESXi 5.0 as well as ESXi 5.1
To confirm we have succesfully installed our custom VIB, we can query it by running the following command:
esxcli software vib list | grep virtuallyghetto