This repository contains a set of command-line tools for managing VMware ESXi virtual machines.
The tools are packaged as an RPM for easy installation.
To build the RPM package, navigate to the root of this repository and run the build.sh script:
./build.shThis will create an RPM file in ~/rpmbuild/RPMS/noarch/.
Before installing the RPM, you need to install the pyvmomi library using pip:
pip install pyvmomiOnce the RPM is built, you can install it using your system's package manager (e.g., dnf or yum):
sudo dnf install ./rpmbuild/RPMS/noarch/vm_devtools-1.0.0-1.noarch.rpm
# Or for older systems:
# sudo yum install ./rpmbuild/RPMS/noarch/vm_devtools-1.0.0-1.noarch.rpmAfter installation, you need to configure your VMware ESXi credentials and main VM. Run the setup script:
sudo setup_vm_devtoolsThis script will prompt you for your VMware username, password, IP address, and the name of your main VM. This information will be saved in /etc/vm_devtools/.env.
Once configured, you can use the following commands:
vm_list_all: Lists all virtual machines accessible by your configured VMware ESXi server.vm_power_on [VM_NAME]: Powers on a specified virtual machine. IfVM_NAMEis not provided, it will power on theVM_MAINconfigured during setup.vm_power_off [VM_NAME]: Powers off a specified virtual machine. IfVM_NAMEis not provided, it will power off theVM_MAINconfigured during setup.vm_reboot [VM_NAME]: Reboots a specified virtual machine. IfVM_NAMEis not provided, it will reboot theVM_MAINconfigured during setup.vm_restore_snapshot [VM_NAME]: Restores the latest snapshot of a specified virtual machine. IfVM_NAMEis not provided, it will restore the latest snapshot of theVM_MAINconfigured during setup.
Example:
vm_list_all
vm_power_on my_dev_vm
vm_restore_snapshot