vagrant 로 ansible, puppet, chef를 쓰지 않아도 간단하게 shell 만으로도 배포(provision)이 가능하다. 


아래아 같은 Vagrantfile 예제를 활용한다. 


$ vi Vagrantfile


# 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.vm.box = "precise64"

    config.vm.box_url = "http://files.vagrantup.com/precise64.box"


    config.vm.hostname = "web"

    config.vm.network "private_network", ip: "192.168.1.50"

    config.vm.network :forwarded_port, guest: 9966, host: 3333



    config.vm.provision :shell, :path => "test.sh"

    config.vm.define :testing do |test|

        test.vm.provision :shell, inline: 'echo XXXXX'

    end


end




결과 화면

$ vagrant provision

==> testing: Running provisioner: shell...

    testing: Running: /var/folders/nx/lkzmd37d6fj3sg9kg5flt3yr0000gp/T/vagrant-shell20140714-98395-6wvcso.sh

==> testing: stdin: is not a tty

==> testing: total 12

==> testing: drwxr-xr-x  3 root    root    4096 Sep 14  2012 .

==> testing: drwxr-xr-x 24 root    root    4096 Jul 13 18:18 ..

==> testing: drwxr-xr-x  4 vagrant vagrant 4096 Sep 14  2012 vagrant

==> testing: Running provisioner: shell...

    testing: Running: inline script

==> testing: stdin: is not a tty

==> testing: XXXXX





Posted by '김용환'
,