UPDATE README.md

master
ifiguero 2020-07-23 23:51:32 -04:00
parent d7e0b8c254
commit 340ae161c3
2 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,24 @@
TL-DR
-----
On a clean VM as root
```
apt install python3-pip git
git clone https://github.com/Kodomo/esxi-vm
pip3 install paramiko pyyaml
cd esxi-vm
make install
```
then, as a normal user you setup your credentials and create a VM
```
esxi-vm-create -u -H esxi.host.local -U root -P My!Secure#Password
esxi-vm-create -n TestDebian8VM
```
the VM is fully compatible with VMWare ESXi 6.0
Introduction Introduction
------------ ------------
@ -13,7 +34,8 @@ Requirements
* Python **3**, [paramiko](http://www.paramiko.org) and [PyYAML](https://github.com/yaml/pyyaml): * Python **3**, [paramiko](http://www.paramiko.org) and [PyYAML](https://github.com/yaml/pyyaml):
``` ```
pip install paramiko pyyaml apt install python3-pip
pip3 install paramiko pyyaml
``` ```
Usage Usage
@ -50,7 +72,7 @@ Command Line Args
usage: esxi-vm-create [-h] [-d] [-H HOST] [-T PORT] [-U USER] [-P PASSWORD] usage: esxi-vm-create [-h] [-d] [-H HOST] [-T PORT] [-U USER] [-P PASSWORD]
[-K KEY] [-n NAME] [-c CPU] [-m MEM] [-v HDISK] [-i ISO] [-K KEY] [-n NAME] [-c CPU] [-m MEM] [-v HDISK] [-i ISO]
[-N NET] [-M MAC] [-S STORE] [-g GUESTOS] [-o VMXOPTS] [-N NET] [-M MAC] [-S STORE] [-g GUESTOS] [-o VMXOPTS]
[-V] [--summary] [-u] [-p POOL] [-V] [--summary] [-u]
ESXi Create VM utility. ESXi Create VM utility.
@ -64,10 +86,11 @@ optional arguments:
ESXi Host password (*****) ESXi Host password (*****)
-K KEY, --Key KEY ESXi Host path to private key () -K KEY, --Key KEY ESXi Host path to private key ()
-n NAME, --name NAME VM name () -n NAME, --name NAME VM name ()
-p POOL, --pool NAME Resource pool to attach the VM (ha-root-pool)
-c CPU, --cpu CPU Number of vCPUS (2) -c CPU, --cpu CPU Number of vCPUS (2)
-m MEM, --mem MEM Memory in GB (4) -m MEM, --mem MEM Memory in MB (4096)
-v HDISK, --vdisk HDISK -v HDISK, --vdisk HDISK
Size of virt hdisk (20) Size of virt hdisk (16)
-i ISO, --iso ISO CDROM ISO Path | None (None) -i ISO, --iso ISO CDROM ISO Path | None (None)
-N NET, --net NET Network Interface | None (None) -N NET, --net NET Network Interface | None (None)
-M MAC, --mac MAC MAC address -M MAC, --mac MAC MAC address
@ -125,6 +148,7 @@ Saving new Defaults to ~/.esxi-vm.yml
./esxi-vm-create -n testvm01 --summary ./esxi-vm-create -n testvm01 --summary
Create VM Success: Create VM Success:
RESOURCE POOL: ha-root-pool
VM NAME: testvm01 VM NAME: testvm01
vCPU: 2 vCPU: 2
Memory: 4GB Memory: 4GB
@ -136,7 +160,7 @@ Network: None
* Change default number of vCPUs to `4`, Memory to `8GB` and vDisk size to `40GB`: * Change default number of vCPUs to `4`, Memory to `8GB` and vDisk size to `40GB`:
```bash ```bash
./esxi-vm-create -c 4 -m 8 -v 40 -u ./esxi-vm-create -c 4 -m 8096 -v 40 -u
Saving new Defaults to ~/.esxi-vm.yml Saving new Defaults to ~/.esxi-vm.yml
``` ```
@ -169,10 +193,11 @@ Register VM
Power ON VM Power ON VM
Create VM Success: Create VM Success:
RESOURCE POOL: ha-root-pool
ESXi Host: esxi ESXi Host: esxi
VM NAME: testvm03 VM NAME: testvm03
vCPU: 4 vCPU: 4
Memory: 8GB Memory: 8096MB
VM Disk: 40GB VM Disk: 40GB
Format: thin Format: thin
DS Store: DS_3TB_m DS Store: DS_3TB_m
@ -196,7 +221,7 @@ Create VM Success:
ESXi Host: esxi ESXi Host: esxi
VM NAME: testvm04 VM NAME: testvm04
vCPU: 4 vCPU: 4
Memory: 8GB Memory: 8096MB
VM Disk: 40GB VM Disk: 40GB
Format: thin Format: thin
DS Store: DS_3TB_m DS Store: DS_3TB_m
@ -258,12 +283,17 @@ This is a fork. Summary of changes in this fork:
* `esxi-vm-destroy` is documented * `esxi-vm-destroy` is documented
* Move some common code in `esxi-vm-create` and `esxi-vm-destroy` to `esxi_vm_functions.py` * Move some common code in `esxi-vm-create` and `esxi-vm-destroy` to `esxi_vm_functions.py`
* Code cleaning (work in progress) * Code cleaning (work in progress)
* VM Memory in MB **not GB** to be able to create low memory VM
* Default VM is now Debian 8-64bits
* Fixed a bug that didn't obtain the list of VMNIC from the esxi instance properly
* Upgraded virtualHW.version 11 (native ESXI 6.0 format)
* Added parameters `--pool` to attach the VM to a resource pool
Copyrights Copyrights
---------- ----------
* **This fork** Copyright © 2020 Israel Figueroa
* **This fork** Copyright © 2018 Sebastien Andrivet * **[fork](https://github.com/andrivet/esxi-vm)** Copyright © 2018 Sebastien Andrivet
* **[Oiginal code](https://github.com/josenk/esxi-vm-create)** Copyright © 2017 Jonathan Senkerik * **[Original code](https://github.com/josenk/esxi-vm-create)** Copyright © 2017 Jonathan Senkerik
License License
------- -------

View File

@ -45,12 +45,10 @@ parser.add_argument("-U", "--User", dest='USER', type=str, help="ESXi Host usern
parser.add_argument("-P", "--Password", dest='PASSWORD', type=str, help="ESXi Host password (*****)") parser.add_argument("-P", "--Password", dest='PASSWORD', type=str, help="ESXi Host password (*****)")
parser.add_argument("-K", "--Key", dest='KEY', type=str, help="ESXi Host path to private key ({})".format(KEY)) parser.add_argument("-K", "--Key", dest='KEY', type=str, help="ESXi Host path to private key ({})".format(KEY))
parser.add_argument("-n", "--name", dest='NAME', type=str, help="VM name ()".format(NAME)) parser.add_argument("-n", "--name", dest='NAME', type=str, help="VM name ()".format(NAME))
parser.add_argument('-V', '--verbose', dest='isVerbosearg', action='store_true', parser.add_argument('-V', '--verbose', dest='isVerbosearg', action='store_true', help="Enable Verbose mode ({})".format(isVerbose))
help="Enable Verbose mode ({})".format(isVerbose))
parser.add_argument('-f', '--logfile', dest='LOG', type=str, help='Path to the log file ({})'.format(LOG)) parser.add_argument('-f', '--logfile', dest='LOG', type=str, help='Path to the log file ({})'.format(LOG))
parser.add_argument('-l', '--log', dest='writeLog', action='store_true', help='Write to log file ({})'.format(writeLog)) parser.add_argument('-l', '--log', dest='writeLog', action='store_true', help='Write to log file ({})'.format(writeLog))
parser.add_argument('--summary', dest='isSummaryarg', action='store_true', parser.add_argument('--summary', dest='isSummaryarg', action='store_true', help="Display Summary ({})".format(isSummary))
help="Display Summary ({})".format(isSummary))
args = parser.parse_args() args = parser.parse_args()