blog.kirishikistudios.com

About Me   

Just another geek

twitter.com/satully:

    Set up Vagrant with chef-solo on Mountain Lion

    Prerequisites: *gem install vagrant *installed virtualbox(https://www.virtualbox.org/wiki/Downloads) I installed “VirtualBox 4.1.20 for OS X hosts x86/amd64”.

    VM List http://www.vagrantbox.es

    Add new box(centos)

    Yamada-Naoyuki-MacBook-Pro:~ yamadanaoyuki$ vagrant box add centos63 https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
    [vagrant] Downloading with Vagrant::Downloaders::HTTP...
    [vagrant] Downloading box: https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
    [vagrant] Extracting box...
    [vagrant] Verifying box...
    [vagrant] Cleaning up downloaded box...
    

    Initialize Vagrant

    Yamada-Naoyuki-MacBook-Pro:Documents yamadanaoyuki$ mkdir vagrant
    Yamada-Naoyuki-MacBook-Pro:Documents yamadanaoyuki$ cd vagrant/
    Yamada-Naoyuki-MacBook-Pro:vagrant yamadanaoyuki$ vagrant init
    A `Vagrantfile` has been placed in this directory. You are now
    ready to `vagrant up` your first virtual environment! Please read
    the comments in the Vagrantfile as well as documentation on
    `vagrantup.com` for more information on using Vagrant.
    

    Edit Vagrantfile:

    chef-solo cookbook: https://github.com/chokkoyamada/chef-repo/tree/master/cookbooks Edit Vagrantfile

    Vagrant::Config.run do |config|
      (...)
      # Every Vagrant virtual environment requires a box to build off of.
      config.vm.box = "centos63"
      (...)
      config.vm.provision :chef_solo do |chef|
        chef.cookbooks_path = "/Users/yamadanaoyuki/Documents/git/chef-repo/cookbooks"
        chef.add_recipe "vim"
        chef.add_recipe "ruby"
      (...)
      end
    

    Start VM

    Yamada-Naoyuki-MacBook-Pro:vagrant yamadanaoyuki$ vagrant up
    [default] Importing base box 'centos63'...
    [default] The guest additions on this VM do not match the install version of
    VirtualBox! This may cause things such as forwarded ports, shared
    folders, and more to not work properly. If any of those things fail on
    this machine, please update the guest additions and repackage the
    box.
    
    Guest Additions Version: 4.1.18
    VirtualBox Version: 4.1.20
    [default] Matching MAC address for NAT networking...
    [default] Clearing any previously set forwarded ports...
    [default] Forwarding ports...
    [default] -- 22 => 2222 (adapter 1)
    [default] Creating shared folders metadata...
    [default] Clearing any previously set network interfaces...
    [default] Booting VM...
    [default] Waiting for VM to boot. This can take a few minutes.
    [default] VM booted and ready for use!
    [default] Mounting shared folders...
    [default] -- v-root: /vagrant
    [default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
    [default] Running provisioner: Vagrant::Provisioners::ChefSolo...
    [default] Generating chef JSON and uploading...
    [default] Running chef-solo...
    [2012-09-01T22:38:20+02:00] INFO: *** Chef 10.12.0 ***
    [2012-09-01T22:38:20+02:00] INFO: Setting the run_list to ["recipe[vim]", "recipe[ruby]"] from JSON
    [2012-09-01T22:38:20+02:00] INFO: Run List is [recipe[vim], recipe[ruby]]
    [2012-09-01T22:38:20+02:00] INFO: Run List expands to [vim, ruby]
    [2012-09-01T22:38:20+02:00] INFO: Starting Chef Run for localhost
    [2012-09-01T22:38:20+02:00] INFO: Running start handlers
    [2012-09-01T22:38:20+02:00] INFO: Start handlers complete.
    [2012-09-01T22:38:20+02:00] INFO: Processing package[vim] action install (vim::default line 10)
    [2012-09-01T22:39:04+02:00] INFO: package[vim] installing vim-enhanced-7.2.411-1.8.el6 from base repository
    [2012-09-01T22:39:22+02:00] INFO: package[vim] installed version 7.2.411-1.8.el6
    [2012-09-01T22:39:22+02:00] INFO: Processing template[/home/vagrant/.vimrc] action create (vim::default line 14)
    [2012-09-01T22:39:22+02:00] INFO: template[/home/vagrant/.vimrc] owner changed to 500
    [2012-09-01T22:39:22+02:00] INFO: template[/home/vagrant/.vimrc] group changed to 500
    [2012-09-01T22:39:22+02:00] INFO: template[/home/vagrant/.vimrc] updated content
    [2012-09-01T22:39:22+02:00] INFO: Processing script[install_libyaml] action run (ruby::default line 10)
    [2012-09-01T22:39:50+02:00] INFO: script[install_libyaml] ran successfully
    [2012-09-01T22:39:50+02:00] INFO: Processing script[install_ruby] action run (ruby::default line 24)
    [2012-09-01T22:43:44+02:00] INFO: script[install_ruby] ran successfully
    [2012-09-01T22:43:44+02:00] INFO: Chef Run complete in 323.902273 seconds
    [2012-09-01T22:43:44+02:00] INFO: Running report handlers
    [2012-09-01T22:43:44+02:00] INFO: Report handlers complete
    
    — 9 months ago