Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Created October 29, 2013 13:51
Show Gist options
  • Save miguelbermudez/7215045 to your computer and use it in GitHub Desktop.
Save miguelbermudez/7215045 to your computer and use it in GitHub Desktop.
Python Vagrant Box
Exec {
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}
#########################################################
# The below section describes which packages will be ##
# loaded into the box. Please include only the ##
# needed packages per project. Defaults have been ##
# commented for convenience. ##
#########################################################
class core {
exec { "apt-update":
command => "/usr/bin/sudo apt-get -y update"
}
package {
[ "build-essential" ]:
ensure => ["latest"],
require => Exec['apt-update']
}
}
class python {
package {
[ "python", "python-setuptools", "python-dev", "python-pip",
"python-matplotlib", "python-imaging", "python-numpy", "python-scipy",
"python-software-properties", "python-qt4", "python-wxgtk2.8" ]:
ensure => ["installed"],
require => Exec['apt-update']
}
exec {
"virtualenv":
command => "/usr/bin/sudo pip install virtualenv",
require => Package["python-dev", "python-pip"]
}
}
class pythondev {
package {
[ "dpkg-dev", "swig", "python2.7-dev", "libwebkitgtk-dev", "libjpeg-dev", "libtiff4-dev",
"checkinstall", "ubuntu-restricted-extras", "freeglut3", "freeglut3-dev", "libgtk2.0-dev", "libsdl1.2-dev",
"libgstreamer-plugins-base0.10-dev", "libwxgtk2.8-dev", "ipython" ]:
ensure => ["installed"],
require => Exec['apt-update']
}
}
class web {
package {
[ "python-twisted" ]:
ensure => ["installed"],
require => Exec['apt-update']
}
exec {
"bottle":
command => "/usr/bin/sudo pip install bottle",
require => Package["python-dev", "python-pip"]
}
exec {
"sqlalchemy":
command => "/usr/bin/sudo pip install sqlalchemy",
require => Package["python-pip"],
}
exec {
"south":
command => "/usr/bin/sudo pip install south",
require => Package["python-pip"],
}
exec {
"django":
command => "/usr/bin/sudo pip install django",
require => Package["python-pip"],
}
exec {
"beautifulsoup4":
command => "/usr/bin/sudo pip install -U beautifulsoup4",
require => Package["python-pip"]
}
exec {
"mechanize":
command => "/usr/bin/sudo pip install mechanize",
require => Package["python-pip"]
}
exec {
"scrapelib":
command => "/usr/bin/sudo pip install scrapelib",
require => Package["python-pip"]
}
exec {
"Pyes":
command => "/usr/bin/sudo pip install Pyes",
require => Package["python-pip"]
}
exec {
"Mongoengine":
command => "/usr/bin/sudo pip install -U mongoengine",
require => Package["python-pip"]
}
}
class flask {
exec {
"fabric":
command => "/usr/bin/sudo pip install Fabric",
require => Package["python-pip"],
}
exec {
"Flask":
command => "/usr/bin/sudo pip install Flask",
require => Package["python-pip"],
}
exec {
"flask-sqlalchemy":
command => "/usr/bin/sudo pip install Flask-SQLAlchemy",
require => Package["python-pip"],
}
exec {
"flask-script":
command => "/usr/bin/sudo pip install Flask-Script",
require => Package["python-pip"],
}
exec {
"flask-wtforms":
command => "/usr/bin/sudo pip install Flask-WTF",
require => Package["python-pip"],
}
exec {
"argparse":
command => "/usr/bin/sudo pip install argparse",
require => Package["python-pip"],
}
exec {
"distribute":
command => "/usr/bin/sudo pip install distribute",
require => Package["python-pip"],
}
exec {
"flup":
command => "/usr/bin/sudo pip install flup",
require => Package["python-pip"],
}
}
include core
include python
include pythondev
include web
include nginx
include flask
include mongodb
include redis
# -*- 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|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "puppetlabs-precise64"
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box"
config.vm.hostname = "dev.python.vm"
config.vm.network :forwarded_port, guest: 80, host: 8080
#config.vm.network :private_network, ip: "192.168.33.10"
config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "~/Documents/multimedia/development/Python/", "/project/"
# Enable shell provisioning to bootstrap puppet
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "site.pp"
puppet.module_path = "puppet/modules"
puppet.options = "--verbose"
end
# VirtualBox Specific Customization
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment