Giter Club home page Giter Club logo

ezmomi's Introduction

Build Status ezmomi

A simple Linux command line interface for common VMware vSphere VM tasks.

EZmomi uses pyvmomi (VMware vSphere API Python Bindings).

Requirements

vSphere 6
Python 2.7 or 3.x

(If you are using vSphere 5, install the older ezmomi 0.x: pip install ezmomi==0.4.2)

Install

pip install ezmomi

Example Usage

Clone a template with two static IPs:
ezmomi clone --template centos67 --hostname test01 --cpus 2 --mem 4 --ips 172.10.16.203 172.10.16.204

ips takes any number of ips. See ezmomi clone --help for a list of params.

To optionally run a command/script after clone has started:

ezmomi clone --template centos6 --hostname test01 --cpus 2 --mem 4 --ips 172.10.16.203 172.10.16.204 --post-clone-cmd /usr/local/bin/additional-provisioning-steps.sh

This example would run /usr/local/bin/additional-provisioning-steps.sh on the same host ezmomi is run on. You can reference the EZMOMI_CLONE_HOSTNAME environment variable in your script to retrieve the --hostname.

Clone a template and put vm is specific folder
ezmomi clone --server vcenter_url --template centos67 --hostname test01 --cpus 2 --mem 4 --destination-folder "/DC/folder/" --ips 172.10.16.203 172.10.16.204

This example will put the cloned vm to specific destination folder in specified vcenter.

Power Operations

Guest shutdown

ezmomi shutdown --name test01

This command falls back to powerOff if VMware guest tools are not installed/available.

Power On/Off

ezmomi powerOn --name test01
ezmomi powerOff --name test01
Power Status
ezmomi status --name test01
# for much more information add --extra:
ezmomi status --name test01 --extra
Destroy a VM
ezmomi destroy --name test01
VM Snapshot operations

See help for more info on each operation:

ezmomi listSnapshots --help
ezmomi createSnapshot --help
ezmomi removeSnapshot --help
ezmomi revertSnapshot --help
Listing your resources:
ezmomi list --type VirtualMachine
ezmomi list --type Network
ezmomi list --type Datastore
etc...
Disable ssl warnings
ezmomi --no-ssl-verify [command] [options]
Sync a VM's time with ESXi host
ezmomi syncTimeWithHost --name somevm01

See Managed Object Types in the vSphere API docs for a list of types to look up.

Help

Each command section has its own help:

ezmomi --help
ezmomi clone --help
ezmomi list --help
etc...

Install via github

git clone https://github.com/snobear/ezmomi.git
# using python2.7 virtualenv
virtualenv -p python2.7 --no-site-packages ezmomi
cd ezmomi && source bin/activate
pip install -r requirements.txt
export PYTHONPATH=$PWD:$PYTHONPATH
ezmomi --help

Contributing

Pull requests, bug reports, and feature requests are extremely welcome.

ezmomi's People

Contributors

bsherman avatar czee avatar felsys avatar mchlumsky avatar sitle avatar snobear avatar tmadmac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.