Coder Social home page Coder Social logo

esxi2mikrotik's Introduction

vCenter mikrotik

ESXi2Mikrotik

This is a handy little utility created to speedup the workflow on my home ESXi/vCenter lab. If you have a similarly operated lab it may save you some time while testing multiple VMs.

Prerequisites

  • Tested on vCenter 6.5.0
  • Tested on Mikrotik 6.39.2
  • VM image: Ubuntu 16.04.2 server 64bit

Usual test-workflow

  1. Create a VM in ESXi/vCenter (usually, cloning a template with a generic image)
  2. Find the VM's MAC address on ESXi/vCenter console.
  3. Create a DHCP entry in Mikrotik for the new VM
  4. Create a DNS entry in Mikrotik for the new VM
  5. Modify VM's /etc/hostname
  6. Modify VM's /etc/hosts
  7. Reboot the VM
  8. Check the VM is accessible on the new IP address

This script automates all steps but #1. #1 could be easily automated too, however providing VM-level configuration options would be far outside the scope of this script.

Usage

Running

Usage instructions:

java -jar target/esxi2mikrotik-1.0.0-SNAPSHOT.jar

Example:

java -jar esxi2mikrotik-1.0.0-SNAPSHOT.jar \
    -eh vcenter.domain \
    -eu [email protected] \
    -ep secret \
    -mh mikrotik.domain \
    -mu admin \
    -mp secret2 \
    -vn MyTestVM \
    -vh my-test-vm.domain \
    -vi 1.2.3.4 \
    -vu superuser \
    -vp secret3

Parameters

usage: help
 -eh,--esxiHostname <arg>       ESXi/vCenter hostname
 -ep,--esxiPassword <arg>       ESXi/vCenter password
 -eu,--esxiUsername <arg>       ESXi/vCenter username
 -mh,--mikrotikHostname <arg>   Mikrotik hostname
 -mp,--mikrotikPassword <arg>   Mikrotik password
 -mu,--mikrotikUsername <arg>   Mikrotik username
 -vh,--vmHostname <arg>         The hostname to be assigned to the VM
 -vi,--vmIP <arg>               The new IP for the VM
 -vn,--vmName <arg>             The name of the VM in ESXi/vCenter
 -vp,--vmPassword <arg>         The password to connect to the VM via SSH
 -vu,--vmUsername <arg>         The username to connect to the VM via SSH

Development

Building

To build this script you need Java 1.8.x, Maven 3.2.x, an Internet connection and running the following command:

mvn clean install

Testing while building

mvn install exec:java \-Dexec.args="\
    -eh vcenter.domain \
    -eu [email protected] \
    -ep secret \
    -mh mikrotik.domain \
    -mu admin \
    -mp secret2 \
    -vn MyTestVM \
    -vh my-test-vm.domain \
    -vi 1.2.3.4 \
    -vu superuser \
    -vp secret3"

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.