Skip to content

Instantly share code, notes, and snippets.

@mohitsethi
Created October 6, 2015 08:56
Show Gist options
  • Select an option

  • Save mohitsethi/5ba40fadd0f25524fa8c to your computer and use it in GitHub Desktop.

Select an option

Save mohitsethi/5ba40fadd0f25524fa8c to your computer and use it in GitHub Desktop.
Vagrantfile
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
dir_pwd = Dir.pwd
dir_chef_repo = dir_pwd
dir_chef = "#{dir_chef_repo}/.chef"
# dir_cookbooks = "#{dir_pwd}/cookbooks"
dir_cookbooks = "#{dir_pwd}/cookbooks"
dir_roles = "#{dir_pwd}/roles"
dir_nodes = "#{dir_pwd}/nodes"
chef_org_name = "chef-training"
chef_node_name = "mynode-name-ms"
REPOSITORY_IP = "http://9.124.129.184:8080/"
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-1404"
config.ssh.pty = true
config.vm.box_url = "#{REPOSITORY_IP}/pkg/boxes/ubuntu-14.04_chef-provisioner.box"
# For Redhat, Centos, Fedora, etc
# config.vm.provision :shell, :inline => "command -v yum >/dev/null 2>&1 && sudo yum install curl -y && sudo rpm -ivh #{REPOSITORY_IP/chef-11.18.12-1.el6.x86_64.rpm}"
# config.vm.provision :shell, :inline => "command -v knife >/dev/null 2>&1 || sudo rpm -ivh #{REPOSITORY_IP}/rpm/chef-11.18.12-1.el6.x86_64.rpm"
# For Ubuntu
# config.vm.provision :shell, :inline => "command -v apt-get >/dev/null 2>&1 && sudo apt-get update -y && sudo apt-get install curl -y"
# config.vm.provision :shell, :inline => "command -v knife >/dev/null 2>&1 || wget #{REPOSITORY_IP}/ubuntu/chef_11.18.12-1_i386.deb || sudo dpkg -i chef_11.18.12-1_i386.deb"
# VM Configuration
config.vm.define :dev_solo do |vm_config|
vm_config.vm.hostname = "my-dev-machine"
vm_config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 512]
vb.gui = true
end
vm_config.vm.network :forwarded_port, guest: 80, host: 8889
# Provisioner configuration
vm_config.vm.provision "chef_client" do |chef|
chef.install = false
chef.delete_node = true
chef.delete_client = true
chef.environment = "stage2"
chef.validation_client_name = "ukanth-validator"
chef.chef_server_url = "https://api.opscode.com/organizations/ukanth"
chef.validation_key_path = ".chef/ukanth-validator.pem"
# Add a recipe
chef.add_recipe 'apache'
# # Add a role
# chef.add_role 'web'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment