Skip to content

Instantly share code, notes, and snippets.

@mihok
Last active August 7, 2016 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mihok/3f67533f25501c4109e69a5bf96e7f30 to your computer and use it in GitHub Desktop.
Save mihok/3f67533f25501c4109e69a5bf96e7f30 to your computer and use it in GitHub Desktop.
Basic Vagrantfile template and base provision script
#!/bin/bash
set -x;
apt-get update -y
apt-get upgrade -y
apt-get install -y nmap htop ntp httpie gnupg2
apt-get autoremove -y
# -*- mode: ruby -*-
# vi: set ft=ruby :
$instances = 1
$instance_name_prefix = "app"
$app_cpus = 1
$app_memory = 1024
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
(1..$instances).each do |i|
config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config|
config.vm.hostname = vm_name
# Set the VM memory and cpu allocations
config.vm.provider :virtualbox do |vb|
vb.memory = $app_memory
vb.cpus = $app_cpus
end
# Create a private network, which allows host-only access to the machine
# using a specific IP.
ip = "44.0.0.#{i+100}"
config.vm.network :private_network, ip: ip
config.vm.network "public_network"
config.vm.provision "shell", path: "util.sh", name: "utilities"
# Start here
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment