akrush24 / vmware-automation

This are a set of scripts to simplify the deployment of virtual machines in the VMWare vSphere infrastructure from python scrip
6 stars 2 forks source link
autodeploy autodeployments linux phpipam python python-scrip terraform virtual-machines vmware vmware-automation vmware-vsphere-infrastructure windows

VMware Automation

This are a set of scripts to simplify the deployment of virtual machines in the VMWare vSphere infrastructure from python script.

INSTALLATION

pip3 install pyVim pyVmomi requests argcomplete paramiko python_terraform requests 

For autocomplete in bash

echo 'eval "$(register-python-argcomplete YouScriptDir(ex. ./run.sh) )"' >> ~/.bashrc sourse ~/.bashrc


### PHPipam ###
For this stack need PhpIPAM system: https://github.com/phpipam/phpipam

Add ```$api_allow_unsafe = true;``` in config.php in your phpipam system

Example for create Only new IP in PHPIpam system run:

./run.py \ --vmname=test-vm01 \ --desc="Test IP" --net=192.168.222.0/24 \ --onlyip


### Credentials ###
Before use create credential file

cat >passwd.py<<EOF! user_api = 'you_user_name' # IPAM user pass_api = 'pwd' # IPAM user password vc_user = 'you_user_name' # vCenter administrator user name vc_pass = 'pwd' # vCenter administrator user password sd_user = 'you_user_name' # ServiceDesk User sd_pass = 'pwd' # ServiceDesk password

EOF!


### PARAMETERS file ###

cat >parameters.py<<EOF! vc_list = [ 'vcsa01.srv.local', 'vcsa02.srv.local', .... ]

template_linux = [ 'template_centos', 'template_ubuntu' ...... ]

template_wind = [ 'template_win2008', 'template_win2012R2', ...... ]

template_list = template_linux + template_wind EOF!


### HELP ###
For Help USAGE: 

./run.py --help