Skip to content

Instantly share code, notes, and snippets.

@ychubachi
Created July 11, 2013 13:26
Show Gist options
  • Save ychubachi/5975423 to your computer and use it in GitHub Desktop.
Save ychubachi/5975423 to your computer and use it in GitHub Desktop.
ChefもKnifeも知らない初心者がBerkshelfに頼ってVagrantでVMを構築する例. ref: http://qiita.com/ychubachi@github/items/8c57481b85865e562c47
diff --git a/Berksfile b/Berksfile
index c4bb297..6d86dcf 100644
--- a/Berksfile
+++ b/Berksfile
@@ -1,3 +1,4 @@
site :opscode
metadata
+cookbook 'git'
--git a/Vagrantfile b/Vagrantfile
index f7e6e9f..efdbb32 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -6,14 +6,14 @@ Vagrant.configure("2") do |config|
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
- config.vm.hostname = "precise-berkshelf"
+ config.vm.hostname = "precise"
# Every Vagrant virtual environment requires a box to build off of.
- config.vm.box = "Berkshelf-CentOS-6.3-x86_64-minimal"
+ config.vm.box = "precise"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
- config.vm.box_url = "https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box"
+ config.vm.box_url = "http://files.vagrantup.com/precise32.box"
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
$ gem install berkshelf
$ vagrant plugin install vagrant-berkshelf
$ berks cookbook precise
create precise/files/default
create precise/templates/default
create precise/attributes
(省略)
run git init from "./precise"
create precise/Gemfile
create precise/Vagrantfile
$ vagrant reload
$ cd precise
$ git add .
$ git commit -a -m 'Initial commit'
$ vim Vagrantfile
$ vagrant up
$ vagrant ssh
$ vim Berksfile
$ vim Vagrantfile
diff --git a/Vagrantfile b/Vagrantfile
index efdbb32..dbb240a 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -80,7 +80,8 @@ Vagrant.configure("2") do |config|
}
chef.run_list = [
- "recipe[precise::default]"
+ "recipe[precise::default]",
+ "git"
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment