Skip to content

mcorp/provisioning

Repository files navigation

mcorp provisioning for vagrant

Dependencies

Run to install dependencies (ubuntu only):

$ ./host-dependencies.sh

Using

export $BASE_PATH=~/projects
mkdir -p $BASE_PATH
cd $BASE_PATH
git clone git@github.com:mcorp/provisioning.git
cp provisioning/Vagrantfile.example Vagrantfile
vi Vagrantfile

Then add your box like you already do:

vagrant box add some_name ubuntu/trusty64
vagrant box add your_custom_box http://path.to/your/box.box
vagrant up yourboxname

Vagrant will automatic run provision when the box came up first time, but if you want to run again:

vagrant provision yourboxname

Roles avaliable

See roles directory

Example of vagrant file

Vagrant.configure('2') do |cfg|
  cfg.vm.synced_folder "/path/to/projects", "/vagrant", nfs: true

  cfg.vm.define "mcorp" do |config|
    config.vm.network :private_network, ip: "10.11.12.13"
    config.vm.box = "ubuntu/trusty64"
    config.vm.network :forwarded_port, guest: 3000, host: 3000
    config.vm.network :forwarded_port, guest: 4000, host: 4000
    config.vm.network :forwarded_port, guest: 5432, host: 5432 # PostgreSQL
    config.ssh.forward_agent = true


    config.vm.provision 'ansible' do |ansible|
      ansible.playbook = 'provisioning/mcorp.box.yml'
      ansible.sudo = true
      ansible.host_key_checking = false
    end
  end
end

More examples

Repackage

cd /mcorp
./box-reset.sh

And follow the instructions. See box-reset.sh file