Last active
August 7, 2016 17:56
-
-
Save mihok/3f67533f25501c4109e69a5bf96e7f30 to your computer and use it in GitHub Desktop.
Basic Vagrantfile template and base provision script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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