Created
December 6, 2013 23:06
-
-
Save quicksnap/7833695 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| VAGRANT_INV = "vagrant-inventory" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| singlenode config | |
| # multinode config | |
| end | |
| def singlenode(config) | |
| config.vm.box = "precise32" | |
| # Enable NFS for performance only after provisioning the box. Requires | |
| # nfsd to be installed on box first. | |
| config.vm.synced_folder ".", "/vagrant", nfs: true | |
| # config.vm.provider "virtualbox" do |v| | |
| # v.customize ["modifyvm", :id, "--cpus", 2] | |
| # end | |
| config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
| config.vm.network :private_network, ip: "192.168.50.50" | |
| config.vm.network :forwarded_port, guest: 80, host: 80 | |
| # config.vm.provision :ansible do |ansible| | |
| # # This provider will actually run for all hosts based on inventory/private network | |
| # # https://github.com/mitchellh/vagrant/issues/1784 | |
| # ansible.playbook = "ansible/site.yml" | |
| # ansible.inventory_path = 'ansible/vagrant-inventory' | |
| # # ansible.extra_vars = { is_vagrant: true } | |
| # ansible.verbose = "vv" # DO NOT REMOVE -- Workaround for a bug with ansible provision. | |
| # end | |
| end | |
| def multinode(config) | |
| config.vm.box = "precise32" | |
| # Enable NFS for performance only after provisioning the box. Requires | |
| # nfsd to be installed on box first. | |
| config.vm.synced_folder ".", "/vagrant", nfs: true | |
| # config.vm.provider "virtualbox" do |v| | |
| # v.customize ["modifyvm", :id, "--cpus", 2] | |
| # end | |
| config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
| # Multiple boxes | |
| # NFS Needs to boot up first.. cause, ya know. | |
| config.vm.define "nfs" do |sql| | |
| sql.vm.network :private_network, ip: "192.168.50.30" | |
| end | |
| config.vm.define "load_balance" do |load_balance| | |
| load_balance.vm.network :private_network, ip: "192.168.50.50" | |
| load_balance.vm.network :forwarded_port, guest: 80, host: 80 | |
| end | |
| config.vm.define "web" do |web| | |
| web.vm.network :private_network, ip: "192.168.50.10" | |
| end | |
| config.vm.define "sql" do |sql| | |
| sql.vm.network :private_network, ip: "192.168.50.20" | |
| # We run Ansible only on the last-defined VM, due to provisioning issue below | |
| last_vm = sql | |
| last_vm.vm.provision :ansible do |ansible| | |
| # This provider will actually run for all hosts based on inventory/private network | |
| # https://github.com/mitchellh/vagrant/issues/1784 | |
| ansible.playbook = "ansible/site.yml" | |
| ansible.inventory_path = 'ansible/vagrant-inventory' | |
| # ansible.extra_vars = { is_vagrant: true } | |
| ansible.verbose = "vv" # DO NOT REMOVE -- Workaround for a bug with ansible provision. | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment