Thursday, May 26, 2016

Yet another revision control system

Git is new to me. Git is probably the 5th or 6th revision control system that I have used (i.e. sccs, rcs, ...).

Setting up git merge and git diff using opendiff
http://stackoverflow.com/questions/21486481/is-it-possible-to-view-git-diffs-using-a-gui-side-by-side-tool-on-mac

Tuesday, May 17, 2016

how to install a home grown Google Chrome extension on OSX or Windows

Make temporary directory
mv the crx file to the temporary directory
Unzip the crx file

http://www.howtogeek.com/233355/how-to-install-extensions-from-outside-the-chrome-web-store-and-firefox-add-ons-gallery/

To do this, open the Extensions page — click the menu button, point to “More tools”, and select “Extensions”. Click the “Developer mode” checkbox to activate it, and then click the “Load unpacked extension” button. Navigate to the extension’s directory and open it.

Developer Mode Route
1. Download the crx file and unpack the extension using your favorite decompresser. Take note of the directory where you placed it.
2. Open the extension page and activate “Developer Mode”.
3. Click “Load unpacked extension…”
4. Search through your directory tree for the location where you unpacked your extension and click OK. If your extension is called “my extension”, then select the “my extension” directory.
Advantages: You do not have to install anything else.
Disadvantages: Chrome nags you to disable the extension every time you start it up.


Sunday, May 15, 2016

How to run a Python script in a virtualenv

http://stackoverflow.com/questions/11963019/running-python-script-from-inside-virtualenv-bin-is-not-working

Or another option is to simply create a tiny bash wrapper that calls your original pythons script, which will allow you to leave your original script with a generic she-bang..
So if myscript.py is: #!/usr/bin/env python ...
Then you can make a myscript :
#!/bin/bash

/Users/foo/environments/project/env/bin/python myscript.py
When you do myscript, it will explicitly call your python script with the interpreter you set up.
If you have to pass args to the lower level script:

#!/bin/bash
echo $@
/Users/foo/environments/project/env/bin/python myscript.py $@


Friday, May 13, 2016

Blogger syntax higlighting

Attention:
Do not use a dynamic template. Syntax highlighting won't work.
http://stackoverflow.com/questions/12464924/blogger-syntaxhighlighter-doesnt-work-at-all
From the above:

I had the same problem. The instructions to set up SyntaxHighlighter seemed easy enough. And all tutorials were more or less comparable including the comment "on my blog it works, if it doesn't work for you then you must be doing something wrong". Nothing worked for me, I got no highlighting.

The solution was to switch to another Blogger template. It just didn't work with the dynamic template I chose. Switching to a simple template did the trick. Highlighting now works.

By the way: While chasing for errors I also tried Prettify as an alternative. It also didn't work. Seems like the dynamic template did something which caused both syntax highlighters to fail.

based on:

http://www.danielhansen.net/2014/06/how-to-format-code-and-syntax.html

http://oneqonea.blogspot.it/2012/04/how-do-i-add-syntax-highlighting-to-my.html

<?php
$example = range(0, 9);
foreach ($example as $value)
{
 echo $value;
}

Custom configuration:
http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/

Vagrant trouble shooting

https://github.com/Varying-Vagrant-Vagrants/VVV/issues/375

1. run the sshd command

chkconfig sshd on
chkconfig --list sshd

service sshd status

2. Start a VM in the VBox GUI
what is the message
3. Check the virtualization settings in the bios 
4. May be a firewall issue
5. Check that you can ssh to localhost

From the above link:

"I see there are still some users who are experiencing this issue. So, I will attempt to summarise a list below of some possible solutions to the SSH timeout problem:
Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often)
Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC / Mac, the VM will take while to boot into an SSH ready state, so timeouts will happen.
Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault.
If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again.
If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the machine beforehand. If the GUI doesn't show anything happening (ie. just blackscreen, no text) while it is booting, then your vagrant machine has got problems.
Destroy the entire machine through the VB interface and reinstall.
Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install.
Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in your Bios disabling this feature.
Disable hyper-v feature if you are running windows 7 or 8. Google how to disable.
Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads
Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new directory.
Make sure you are using the latest vagrant and virtualbox versions.
Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.
Hope that helps.
a processor has to have HW support for virtualization in order to launch virtual machines (VM's)
Yeah I was having this same error on my Windows 7 64 bit laptop. To fix I went into the BIOS and looked for the Virtualization Settings. I made sure to enable Intel Virtualization. Once that was done and the machine rebooted I was able to 'vagrant up" with no problem.
This may not be a solution for every case, but it's worth looking into–this suggestion on SO sets thev.gui = true flag, which causes VirtualBox to open the console for the machine as it's booting. In some cases, it may be an error with the boot process that is causing the long delay.
I can confirm that on Ubuntu 14.04 the connection timeout problem with ubuntu/trusty64 virtual machine was fixed when I enabled Intel Virtualization from the BIOS.
service sshd status
what does that return
Best recommendation for me was to load it with GUI (configurable in Vagrantfile).
Logged in with vagrant:vagrant.
Checked if SSHD is running
# service sshd status (CentOs 5.3).
And then tried to run it. It gave me error:
# sudo service sshd start
/var/empty/sshd must be owned by root and not group or world-writable
I had to chown and chmod, that issue was originally introduced by me before.
Just FYI, it can be pretty helpful to simply start the VM in the VirtualBox GUI to see what the issue might be:"

Sunday, May 8, 2016

Vagrant 1.8.1 + VBox 5.0 installation on Debian

wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add -
sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
apt-get update
apt-get -y install linux-headers-$(uname -r) build-essential virtualbox-5.0 dkms
apt-get -y install build-essential
apt-get -y install virtualbox-5.0
apt-get -y install dkms
apt-get -y install rsync

cd /tmp

wget http://download.virtualbox.org/virtualbox/5.0.20/Oracle_VM_VirtualBox_Extension_Pack-5.0.20.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.20.vbox-extpack

wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb
dpkg -i vagrant_1.8.1_x86_64.deb

wget http://download.virtualbox.org/virtualbox/5.0.20/VBoxGuestAdditions_5.0.20.iso
vboxmanage guestcontrol "testvm" updateadditions  --source VBoxGuestAdditions_5.0.20.iso --verbose

Remote server virtualbox commands

http://xmodulo.com/how-to-create-and-start-virtualbox-vm-without-gui.html

http://xmodulo.com/how-to-manage-virtualbox-vms-on-remote-headless-server.html

https://wiki.debian.org/VirtualBox

https://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm

http://www.beyondlinux.com/2011/06/29/how-to-automate-virtual-machine-creation-and-runing-on-virtualbox-by-command-line/
Note that the example commands at the above link are using a syntax that is wrong. See the corrected commands below.

Delete a VM:
VBoxManage unregistervm | [--delete]

Download TinyCore:
http://distro.ibiblio.org/tinycorelinux/downloads.html
wget http://distro.ibiblio.org/tinycorelinux/7.x/x86/release/TinyCore-current.iso

Instructions for OSX ISO disk mounting
http://computerngeek.blogspot.it/2013/08/how-to-mount-virtualbox-vdi-images-on.html

Create a vm and configure it (Linux):
vboxmanage createvm -name testvm1 -register
vboxmanage modifyvm testvm1 --memory 768 --vram 64 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0 
#vboxmanage list ostypes
vboxmanage modifyvm testvm1 --ostype Linux26
vboxmanage createvdi --filename /data/vm/testvm1-disk01.vdi --size 2048
VBoxManage storagectl testvm1 --name "IDE Controller" --add ide
#vboxmanage storagectl testvm1 --name “IntelAHCI” --add ide
vboxmanage modifyvm testvm1 --boot1 dvd --hda /data/vm/testvm1-disk01.vdi --sata on
vboxmanage storageattach testvm1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /data/vm/testvm1-disk01.vdi
mv TinyCore-current.iso /data/vm
vboxmanage storageattach testvm1 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /data/vm/TinyCore-current.iso
VBoxManage startvm testvm1 --type headless


Saturday, May 7, 2016

Automating the generation of Vagrant and Ansible host/server/node config files

Check back later. We will release a set of scripts for bringing up either a vagrant system or dedicated servers running Hortonworks HDP on Centos 7. We will upload the setup scripts and Ansible files and Vagrantfile to github.

Under construction as we bring up a new devops environment for deploying our HDP cluster.
-This post will be updated as we add the scripts to do the conversions.
-We have a boot strapping script for setting up the keyless ssh which we have added to git repo. After everything is debugged we will release the git repo.
Our sysadmin/devops engineer quit and we (the software developers) decided to learn devops. Hence the messy series of posts on Ansible that appeared prior to this post. Trying to clean the blog up...

The aim of this approach is to eliminate the parallel bookkeeping required to copy/convert host information into different file formats and to have a flow which works in Vagrant and on new dedicated servers.

Status: 
We released the Vagrant bring up script using the servers.json file.
We released the ssh key copying program that uses the servers.json file.

Current: 
Next: Ansible bring up

Goal: 
  1. Build/update automatically for Vagrant or Ansible using a single server config file that generates all other files.
  2. Build the same configuration on either a Vagrant cluster or a dedicated cluster, with the only difference being the number of HDP workers.

Why: Avoid consistency problems and parallel bookkeeping for host/server information.

Flow:



    Preparation: Create the host_config.json file with the host names, ip address, optional user names, passwords, configuration name, ...


    servers.json 
    {
        "configurationId": "Hetzner HDP Cluster",
        "servers": [
     {
         "name": "hmaster",
         "box": "centos/7",
         "ram": 512,
         "vcpu": 1,
         "ip_addr": "192.168.100.101",
                "rootPassWord": "abc123456789"
     },
     {
         "name": "hslave0",
         "box": "centos/7",
         "ram": 512,
         "vcpu": 1,
         "ip_addr": "192.168.100.102",
                "rootPassWord": "abc123456789"
     },
     {
         "name": "hslave1",
         "box": "centos/7",
         "ram": 512,
         "vcpu": 1,
         "ip_addr": "192.168.100.103",
                "rootPassWord": "abc123456789"
     }
        ]
    }
    
    

    Prepare-cluster.py script:


    Vagrantfile:


    $ more Vagrantfile
    # -*- mode: ruby -*-
    # # vi: set ft=ruby :
    
    # Specify minimum Vagrant version and Vagrant API version
    Vagrant.require_version '>= 1.6.0'
    VAGRANTFILE_API_VERSION = '2'
    
    # Require JSON module
    require 'json'
    require 'pp'
    
    # Read YAML file with box details
    data = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'servers.json')))
    
    # Create boxes
    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    
    # config.ssh.username = 'root'
    # config.ssh.password = 'vagrant'
    # config.ssh.insert_key = 'true'
    
    
      servers = data["servers"]
      # Iterate through entries in JSON file
      servers.each do |server|
        pp server
        config.vm.define server['name'] do |srv|
          srv.vm.box = server['box']
          srv.vm.network 'private_network', ip: server['ip_addr']
          srv.vm.provider :vmware_fusion do |vmw|
            vmw.vmx['memsize'] = server['ram']
            vmw.vmx['numvcpus'] = server['vcpu']
          end # srv.vm.provider
        end # config.vm.define
      end # servers.each
    end # Vagrant.configure
    
    
    


    Execution steps:

    1. gen-hosts-configs.py
    2. set-blueprint-options.py
    3. Optional: vagrant up (depends on the cluster type)
    4. prepare-cluster.py
    5. ansible
    6. install_blueprints.py
    Resources:
    Ansible cluster configuration example:
    https://github.com/gautamborad/hdp-ansible

    Setting up /etc/hosts
    http://www.rubydoc.info/gems/vagrant-hosts/2.6.0

    Jinja 2 templates
    http://docs.ansible.com/ansible/template_module.html

    Use a Jinja 2 template with the hosts information
    http://www.sebastien-han.fr/blog/2013/08/19/consistent-hosts-file-with-ansible/
    #
    127.0.0.1   localhost   {{ ansible_hostname }}
    192.168.0.1     bla1.mydomain
    192.168.0.2     bla2.mydomain
    192.168.0.3     bla3.mydomain
    192.168.0.4     bla4.mydomain
    192.168.0.5     bla5.mydomain
    
    The yaml file:
    #
    - hosts: all
    
      tasks:
          - name: template test
            action: template src=templates/hosts.j2 dest=/etc/hosts
    

    OSX Ansible installation:
    https://valdhaus.co/writings/ansible-mac-osx/

    Or put Ansible in a virtualenv:
    http://docs.python-guide.org/en/latest/dev/virtualenvs/
    http://docs.ansible.com/ansible/intro_installation.html#latest-releases-on-mac-osx

    Hortonworks prepare environment:
    https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_installing_manually_book/content/prepare-environment.html

    Installing the Ansible control machine:
    http://docs.ansible.com/ansible/intro_installation.html#installing-the-control-machine

    Ansible Ambari installation:
    https://github.com/seanorama/ansible-ambari/blob/master/Vagrantfile

    Ansible provisioning on Vagrant:
    https://www.vagrantup.com/docs/provisioning/ansible.html

    Script provisioning on Vagrant:
    https://nicolasmaillard.com/2015/07/20/provisioning-virtual-dev-hdp-cluster-part-1-vagrant/

    Automation blog:
    http://henning.kropponline.de/2015/01/11/hdp-ansible-playbook-example/

    Developing Ansible modules:
    http://docs.ansible.com/ansible/developing_modules.html

    Ansible Ambari module:
    https://medium.com/@b23llc/managing-distributed-data-products-with-ansible-and-ambari-44c7175555d8#.5znvfj4bz

    Ansible file layout:
    http://leucos.github.io/ansible-files-layout/

    nodes.rb:
    https://github.com/hkropp/vagrant-hdp/blob/master/conf/nodes.rb
    Example:

    ansible playbook for ambari setup:
    https://github.com/hkropp/vagrant-hdp/blob/master/ansible/hdp_centos6_playbook.yml
    https://github.com/seanorama/ansible-ambari/blob/master/site.yml

    Ambari in Ansible:
    https://github.com/mbittmann/ambari-ansible-module

    Ansible Directory Structure:
    http://docs.ansible.com/ansible/playbooks_best_practices.html#directory-layout

    Ansible Vault for secure passwords:
    http://docs.ansible.com/ansible/playbooks_vault.html

    Vagrant-cachier (box caching):
    http://fgrehm.viewdocs.io/vagrant-cachier/

    Blueprints:
    https://github.com/hkropp/vagrant-hdp/blob/master/master_blueprint.json

    https://medium.com/@b23llc/managing-distributed-data-products-with-ansible-and-ambari-44c7175555d8#.ytz5ceqsn

    Some guest additions were not installed (do not ignore this message):
    Fix: https://github.com/geerlingguy/drupal-vm/issues/175
    #
    Error:
    ==> master1: Checking for guest additions in VM...
        master1: No guest additions were detected on the base box for this VM! Guest
        master1: additions are required for forwarded ports, shared folders, host only
        master1: networking, and more. If SSH fails on this machine, please install
        master1: the guest additions and repackage the box to continue.
        master1: 
        master1: This is not an error message; everything may continue to work properly,
    
        master1: in which case you may ignore this message.
    
    Ansible hints:
    http://leucos.github.io/ansible-files-layout/

    Create Digital Ocean instances with ansible

    https://the.binbashtheory.com/using-ansible-with-digitalocean/

    https://www.digitalocean.com/community/tutorials/how-to-install-vagrant-on-a-vps-running-ubuntu-12-04

    VBox extension packs
    https://www.virtualbox.org/manual/ch08.html#vboxmanage-extpack

    https://www.virtualbox.org/wiki/Downloads

    http://download.virtualbox.org/virtualbox/5.0.20/


    This was obtained from y-yoshinoya at https://gist.github.com/y-yoshinoya/413fcd3f6bfcfce54456
    wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add -
    sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
    sudo apt-get update
    sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.3 dkms
    cd /tmp
    wget http://download.virtualbox.org/virtualbox/4.3.20/Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack
    sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack
    
    Updated versions:

    wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add -
    sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
    sudo apt-get update
    sudo apt-get -y install linux-headers-$(uname -r) build-essential virtualbox-4.3 dkms
    cd /tmp

    wget http://download.virtualbox.org/virtualbox/5.0.20/Oracle_VM_VirtualBox_Extension_Pack-5.0.20.vbox-extpack

    VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.20.vbox-extpack

    wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb
    sudo dpkg -i vagrant_1.8.1_x86_64.deb

    Virtualbox install fails on centos 7 due to the wrong kernel headers

    Installing virtualbox on centos 7 had issues.
    $ /sbin/rcvboxdrv setup
    Stopping VirtualBox kernel modules                         [  OK  ]
    Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
    Trying to register the VirtualBox kernel modules using DKMSError! echo
    Your kernel headers for kernel 3.10.0-327.10.1.el7.x86_64 cannot be found at
    /lib/modules/3.10.0-327.10.1.el7.x86_64/build or /lib/modules/3.10.0-327.10.1.el7.x86_64/source.
                                                               [FAILED]
      (Failed, trying without DKMS)
    Recompiling VirtualBox kernel modules                      [FAILED]

      (Look at /var/log/vbox-install.log to find out what went wrong)

    The wrong kernel headers were installed using
    yum install kernel-devel

    Get the kernel version.
    uname -r

    Now download the corresponding kernel headers

    yum install kernel-devel-3.10.0-327.10.1.el7.x86_64

    Rerun:
    $ /sbin/rcvboxdrv setup


    SSH to remote Vagrant boxes

    vagrant share
    https://www.vagrantup.com/docs/share/index.html

    you need a Hashicorp Atlas account to do so:
    https://atlas.hashicorp.com/account/new

    Tuesday, May 3, 2016

    Fixing Vagrant issues

    The machine with the name 'default' was not found configured for this Vagrant environment.
    Or if the Vagrant file has developed a syntax error 

    And you want to vagrant destroy or vagrant halt the machine

    https://github.com/devopsgroup-io/vagrant-hostmanager/issues/102
    From the above URL:
    vagrant global-status --prune

    Monday, May 2, 2016

    More Ambari links

    OSX shortcuts and tips

    more links to Scala and SPARK examples

    http://ampcamp.berkeley.edu/wp-content/uploads/2013/02/Parallel-Programming-With-Spark-Matei-Zaharia-Strata-2013.pdf

    http://docs.scala-lang.org/tutorials/scala-for-java-programmers.html

    http://docs.scala-lang.org/tutorials/scala-for-java-programmers.html

    http://www.openkb.info/2015/01/scala-on-spark-cheatsheet.html

    http://www.openkb.info/2016/03/understanding-pagerank-algorithm-in.html

    http://twitter.github.io/effectivescala/#Functional programming

    http://spark.apache.org/docs/latest/quick-start.html

    https://spark.apache.org/docs/1.6.1/streaming-programming-guide.html

    https://spark.apache.org/docs/1.6.1/streaming-kafka-integration.html

    https://spark.apache.org/docs/1.6.1/api/scala/index.html#org.apache.spark.streaming.receiver.Receiver

    http://scala-lang.org/

    https://cwiki.apache.org/confluence/display/SPARK/Useful+Developer+Tools#UsefulDeveloperTools-IDESetup

    Using Vagrant to create mulitple hosts and accessing the machines using Vagrant networking

    $ gem install json


    Ruby interpreter for debugging
    http://stackoverflow.com/questions/2814077/how-do-i-find-the-ruby-interpreter

    Ruby hash
    http://ruby-doc.org/core-2.0.0/Hash.html

    A Stackoverflow post on Ruby variable syntax
    http://stackoverflow.com/questions/28339025/ruby-on-rails-colon-at-back-or-front-of-variables

    Vagrant multi-machine examples:
    VAGRANT + YAML
    http://blog.scottlowe.org/2016/01/18/multi-machine-vagrant-json/
    https://thornelabs.net/2014/11/13/multi-machine-vagrantfile-with-shorter-cleaner-syntax-using-json-and-loops.html

    Summary of methods...
    https://sukhjinderkainth.wordpress.com/2015/08/19/create-a-multi-machine-vagrant-config-file/

    JSON include into Vagrantfile example:
    http://blog.scottlowe.org/2016/01/18/multi-machine-vagrant-json/

    HDP Cluster on your laptop
    https://uprush.github.io/hdp/2014/12/29/hdp-cluster-on-your-laptop/

    Find Vagrant boxes at Hasicorp
    https://atlas.hashicorp.com/boxes/search

    SSH to Vagrant boxes
    http://scala-lang.org/

    Adding users and their passwords to Vagrant through the Vagrantfile
    http://stackoverflow.com/questions/25758737/vagrant-login-as-root-by-default
    http://stackoverflow.com/questions/32454576/vagrant-ssh-using-username-and-password

    Local DNS
    http://bencane.com/2013/10/29/managing-dns-locally-with-etchosts/

    Ssh to vagrant machine ip address using:
    username: vagrant
    password: vagrant

    $ ssh vagrant@192.168.100.101 
    vagrant@192.168.100.101's password: 
    Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

     * Documentation:  https://help.ubuntu.com/
    New release '14.04.4 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.

    Welcome to your Vagrant-built virtual machine.
    Last login: Tue May  3 02:58:13 2016 from 192.168.100.1

    vagrant@precise64:~$ 

    https://www.vagrantup.com/docs/networking/private_network.html

    vagrant ssh-config command.
    http://www.hashbangcode.com/blog/connecting-vagrant-box-without-vagrant-ssh-command

    1. Get the vagrant ssh configuration using the following command. If there are multiple vagrant machines active then you will see multiple vagrant ssh configs.
    $  vagrant ssh-config 

    2. Now create the command line ssh command using the information from the vagrant ssh-config command output

    From the above link:
    However, what we are doing here is essentially using the local machine to route us to the correct machine based on it's port number. I still wanted to connect to the box via the IP address that I had set for it. This meant using the -o flag to pass in the extra SSH config parameters to the command.
    So assuming that the virtual machine's IP address is 192.168.100.100 then you would connect to it in the following way.
    ssh vagrant@192.168.100.100 -i /your/user/directory/.vagrant.d/insecure_private_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o IdentitiesOnly=yes
    You can simplify this slightly by using your SSH config file to automatically add these parameters to your SSH call when you run it. This assumes the box IP address is the same as above, but you can also include wildcards in the Host header to include a number of Vagrant boxes (based on their IP address).
    1
    2
    3
    4
    5
    6
    7
    
    Host 192.168.100.100
      StrictHostKeyChecking no
      UserKnownHostsFile /dev/null
      IdentitiesOnly yes
      User vagrant
      IdentityFile /your/user/directory/.vagrant.d/insecure_private_key
      PasswordAuthentication no
    This allows you to connect to the box using the following command (without so many of the extra options present).
    ssh vagrant@192.168.100.100

    If you want to SSH directly to the Vagrant VM from a remote host (in the same LAN), the best and easiest way is to use Public Network (VirtualBox's Bridged networking mode).

    An automated way to ssh...
    https://github.com/puphpet/puphpet/issues/1253
    If you want to avoid the password, the easiest way is to use the SSH config file output by vagrant. The trick is to login to default not vagrant@127.0.0.1 or vagrant@localhost. This is because the config output by ssh-config is for a host called default.
    # Write the ssh config to a file
    vagrant ssh-config > ssh.config
    # Tell ssh to use this config file instead of your user config file (if it exists)
    ssh -F ssh.config default
    Alternatively:

    ssh -F ssh.config vagrant@192.168.100.101
    password: vagrant