initial commit of vagrant virtual machine script

This commit is contained in:
Jeff Steinmetz 2015-11-21 21:28:10 -08:00
parent 5888360f5a
commit fb31785f70
15 changed files with 203 additions and 0 deletions

View file

@ -0,0 +1,4 @@
.vagrant
.DS_Store
incubator-zeppelin

View file

@ -0,0 +1,42 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "hashicorp/precise64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine.
# Forward local host port 8090 to zeppelin port 8090
# comment out the following line out to use a fixed IP
config.vm.network "forwarded_port", guest: 8090, host: 8090
# Uncomment to create a private network, which allows access to the machine
# using a specific IP. Port forwarding not required in this case
#config.vm.network "private_network", ip: "192.168.51.52"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible-roles.yml"
end
config.vm.provision "shell", path: "show-instructions.sh", run: "always"
end

View file

@ -0,0 +1,10 @@
---
- name: Run Ansible
hosts: all
sudo: yes
roles:
- common
- java7jdk
- nodejs
- maven
- python-addons

View file

@ -0,0 +1,16 @@
- name: call apt-get update
# this must be first so that apt-get installs to point to correct resources
# Only run "update_cache=yes" if the last one is more than 3600 seconds (1 hour) ago
apt: update_cache=yes cache_valid_time=3600
- name: Install unzip
apt: pkg=unzip state=present
- name: Install curl
apt: pkg=curl state=present
- name: Install git
apt: pkg=git state=present
- name: Install libfontconfig to avoid phatomJs missing dependency issues
apt: pkg=libfontconfig state=present

View file

@ -0,0 +1,3 @@
- name: Install openjdk-7
apt: pkg=openjdk-7-jdk state=present

View file

@ -0,0 +1,22 @@
# setup maven
# Assumes Ubuntu Server 14.04 LTS (HVM)
# Assumes Java 7+ jdk installed
---
- name: download maven
get_url: url=http://apache.mirrorcatalogs.com/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
dest=/tmp/apache-maven-3.3.3-bin.tar.gz
mode=0440
validate_certs=False
- name: extract maven tgz
unarchive: src=/tmp/apache-maven-3.3.3-bin.tar.gz
dest=/usr/local/
copy=no
creates=/usr/local/apache-maven-3.3.3
- name: create symlink to this maven version
file: src=/usr/local/apache-maven-3.3.3/bin/mvn
path=/usr/bin/mvn
state=link

View file

@ -0,0 +1,6 @@
---
# Pin-Priority of NodeSource repository
nodejs_nodesource_pin_priority: 500
# 0.10 or 0.12 or 4.x
nodejs_version: "0.12"

View file

@ -0,0 +1,2 @@
---
# handlers file for nodejs

View file

@ -0,0 +1,18 @@
---
galaxy_info:
author: Mark Wolfe
description: Installs the NodeSource Node.js binary packages
company: NodeSource
license: MIT
min_ansible_version: 1.2
platforms:
- name: Ubuntu
versions:
- precise
- trusty
categories:
- development
- networking
- packaging
- web
dependencies: []

View file

@ -0,0 +1,39 @@
# Install Node.js using packages crafted by NodeSource
---
- name: Ensure the system can use the HTTPS transport for APT
stat:
path: /usr/lib/apt/methods/https
register: apt_https_transport
- name: Install HTTPS transport for APT
apt:
pkg: apt-transport-https
state: installed
when: not apt_https_transport.stat.exists
- name: Import the NodeSource GPG key into apt
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Add NodeSource deb repository
apt_repository:
repo: 'deb https://deb.nodesource.com/node_{{ debian_repo_version }} {{ ansible_distribution_release }} main'
state: present
- name: Add NodeSource deb-src repository
apt_repository:
repo: 'deb-src https://deb.nodesource.com/node_{{ debian_repo_version }} {{ ansible_distribution_release }} main'
state: present
- name: Add NodeSource repository preferences
template:
src: etc/apt/preferences.d/deb_nodesource_com_node.pref.2
dest: /etc/apt/preferences.d/deb_nodesource_com_node.pref
- name: Install Node.js
apt:
pkg:
- nodejs={{ nodejs_version }}*
state: installed
update_cache: yes

View file

@ -0,0 +1,5 @@
# {{ ansible_managed }}
Package: *
Pin: release o=Node Source
Pin-Priority: {{ nodejs_nodesource_pin_priority }}

View file

@ -0,0 +1,3 @@
---
# vars file for nodejs
debian_repo_version: "{{ nodejs_version if '4' not in nodejs_version else '4.x' }}"

View file

@ -0,0 +1,20 @@
# setup zeppelin python dependencies
# Assumes Ubuntu Server 14.04 LTS (HVM) - ami-f64f77b3 64 bit
# Assumes Java 7 installed as part of the top level playbook
---
- name: Install python dependencies. This will take a while.
apt: pkg={{ item }} state=latest
with_items:
- python-pip
- python-matplotlib
- python-scipy
- python-numpy
- python-pandas
# Change python backend that pyspark can render
# matplotlib plots without an interactive window
# Fully quoted because of the ': ' on the line.
- name: use Agg as pythons default window instead of tkAgg
lineinfile: "dest=/etc/matplotlibrc regexp='^backend' line='backend : Agg'"

View file

@ -0,0 +1,13 @@
echo 'From your host machine,'
echo 'git clone the incubator-zeppelin branch into this directory'
echo
echo 'vagrant ssh'
echo
echo '# then when running inside the VM'
echo
echo 'cd /vagrant/incubator-zeppelin'
echo 'mvn clean package -DskipTests'
echo
echo '# or for a specific build'
echo
echo 'mvn clean package -Pspark-1.5 -Ppyspark -Dhadoop.version=2.2.0 -Phadoop-2.2 -DskipTests'