Skip to content

Instantly share code, notes, and snippets.

@zehicle
Last active August 29, 2015 14:24
Show Gist options
  • Save zehicle/787bf9a87f4f1ed995ae to your computer and use it in GitHub Desktop.
Save zehicle/787bf9a87f4f1ed995ae to your computer and use it in GitHub Desktop.
Vagrant File
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "admin", primary: true do |admin|
admin.vm.box = "chef/centos-6.6"
# Create a forwarded port mapping which allows access to a specific port
admin.vm.network "forwarded_port", guest: 3000, host: 3030
admin.vm.network "forwarded_port", guest: 8500, host: 8585
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# admin.vm.network "private_network", ip: "192.168.124.10", auto_config: false
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
admin.vm.network "public_network"
# proxy pass through
if Vagrant.has_plugin?("vagrant-proxyconf") && ENV['http_proxy']
port = ENV['http_proxy'].split(":")[2]
config.proxy.http = "http://10.0.2.2:#{port}"
config.proxy.https = "http://10.0.2.2:#{port}"
config.proxy.no_proxy = "127.0.0.1,[::1],localhost,192.168.124.0/24,192.168.1.0/12,10.0.2.0/24"
else
puts "If you have a local proxy cache, install the proxy plug-in! 'vagrant plugin install vagrant-proxyconf'"
end
# Share an additional folder to the guest VM.
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
admin.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "4096"
end
#
# View the documentation for the provider you are using for more
# information on available options.
admin.vm.provision "shell", inline: <<-SHELL
sed -ie "s/%sudo\tALL=(ALL:ALL) ALL/%sudo ALL=(ALL) NOPASSWD: ALL/g" /etc/sudoers
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
sudo -i
yum install git -y
chkconfig iptables off
service iptables stop
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
chmod 755 ~/.ssh
mkdir /opt/opencrowbar
cd /opt/opencrowbar
# git clone https://github.com/opencrowbar/core/
# cd /opt/opencrowbar/core
#./production.sh admin.opencrowbar.com
SHELL
puts "use 'vagrant up slave' to start slave node"
end
config.vm.define "slave", autostart:false do |slave|
slave.vm.box = "chef/centos-7.1"
slave.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "admin", primary: true do |admin|
FileUtils.mkdir_p "~/.cache" unless File.directory? "~/.cache"
FileUtils.mkdir_p "~/.cache/opencrowbar" unless File.directory? "~/.cache/opencrowbar"
FileUtils.mkdir_p "~/.cache/opencrowbar/tftpboot" unless File.directory? "~/.cache/opencrowbar/tftpboot"
admin.vm.box = "chef/centos-6.6"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
admin.vm.network "forwarded_port", guest: 3000, host: 3001
admin.vm.network "forwarded_port", guest: 8500, host: 8501
# Create a private network, which allows host-only access to the machine
# using a specific IP.
admin.vm.network "private_network", ip: "192.168.124.10", auto_config: false
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
admin.vm.network "public_network"
# proxy pass through
if Vagrant.has_plugin?("vagrant-proxyconf") && ENV['http_proxy']
port = ENV['http_proxy'].split(":")[2]
config.proxy.http = "http://10.0.2.2:#{port}"
config.proxy.https = "http://10.0.2.2:#{port}"
config.proxy.no_proxy = "127.0.0.1,[::1],localhost,192.168.124.0/24,192.168.1.0/12,10.0.2.0/24"
else
puts "If you have a local proxy cache, install the proxy plug-in! 'vagrant plugin install vagrant-proxyconf'"
end
# Share an additional folder to the guest VM.
admin.vm.synced_folder "~/ocb", "/opt/opencrowbar"
admin.vm.synced_folder "~/.cache/opencrowbar/tftpboot", "/tftpboot"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
admin.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "4096"
end
#
# View the documentation for the provider you are using for more
# information on available options.
admin.vm.provision "shell", inline: <<-SHELL
sudo sed -ie "s/%sudo\tALL=(ALL:ALL) ALL/%sudo ALL=(ALL) NOPASSWD: ALL/g" /etc/sudoers
sudo chkconfig iptables off
sudo service iptables stop
sudo /opt/opencrowbar/core/production.sh admin.opencrowbar.com
SHELL
puts "use 'vagrant up slave' to start slave node"
end
config.vm.define "slave", autostart:false do |slave|
slave.vm.box = "chef/centos-7.1"
slave.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Start an OCB cluster (Admin comes up automatically)
# WE RECOMMEND to install proxy > "vagrant plugin install vagrant-proxyconf"
Vagrant.configure(2) do |config|
config.vm.define "admin", primary: true do |admin|
FileUtils.mkdir_p "~/.cache" unless File.directory? "~/.cache"
FileUtils.mkdir_p "~/.cache/opencrowbar" unless File.directory? "~/.cache/opencrowbar"
FileUtils.mkdir_p "~/.cache/opencrowbar/tftpboot" unless File.directory? "~/.cache/opencrowbar/tftpboot"
admin.vm.box = "chef/centos-6.6"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
admin.vm.network "forwarded_port", guest: 3000, host: 3001
admin.vm.network "forwarded_port", guest: 8500, host: 8501
# Create a private network, which allows host-only access to the machine
# using a specific IP.
admin.vm.network "private_network", ip: "192.168.124.10", auto_config: false
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
admin.vm.network "public_network"
# proxy pass through
if Vagrant.has_plugin?("vagrant-proxyconf") && ENV['http_proxy']
port = ENV['http_proxy'].split(":")[2]
config.proxy.http = "http://10.0.2.2:#{port}"
config.proxy.https = "http://10.0.2.2:#{port}"
config.proxy.no_proxy = "127.0.0.1,[::1],localhost,192.168.124.0/24,192.168.1.0/12"
else
puts "If you have a local proxy cache, install the proxy plug-in! 'vagrant plugin install vagrant-proxyconf'"
end
# Share an additional folder to the guest VM.
admin.vm.synced_folder "~/ocb/core", "/opt/opencrowbar"
admin.vm.synced_folder "~/.cache/opencrowbar/tftpboot", "/tftpboot"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
admin.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "4096"
end
#
# View the documentation for the provider you are using for more
# information on available options.
admin.vm.provision "shell", inline: <<-SHELL
sudo sed -ie "s/%sudo\tALL=(ALL:ALL) ALL/%sudo ALL=(ALL) NOPASSWD: ALL/g" /etc/sudoers
sudo chkconfig iptables off
sudo service iptables stop
sudo /opt/opencrowbar/core/production.sh admin.opencrowbar.com
SHELL
puts "use 'vagrant up slave' to start slave node"
end
config.vm.define "slave", autostart:false do |slave|
slave.vm.box = "chef/centos-7.1"
slave.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment