vagrant의  multi-VM environment 설정 예시이다.




# -*- 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.configure(VAGRANTFILE_API_VERSION) do |config|


  config.ssh.insert_key = false


  config.vm.define 'db' do |db|


    db.vm.box = "ubuntu/bionic64"

    db.vm.network "private_network", ip: "192.168.33.11"

    db.ssh.forward_agent = true


    db.vm.provider "virtualbox" do |vb|

      vb.customize ["modifyvm", :id, "--memory", "1024"]

    end

  end


  config.vm.define 'web' do |web|


    web.vm.box = "ubuntu/bionic64"

    web.vm.network "private_network", ip: "192.168.33.10"

    web.ssh.forward_agent = true


    web.vm.provider "virtualbox" do |vb|

      vb.customize ["modifyvm", :id, "--memory", "1024"]

    end


    web.vm.provision "ansible" do |ansible|

      ansible.limit = 'all'

      ansible.playbook = "mezzanine-across-hosts.yml"

    end


  end


end





vagrant ssh db 또는 vagrant ssh web 이렇게 접근할 수 있다. 

Posted by '김용환'
,