Created
July 11, 2013 13:26
-
-
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
This file contains 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
diff --git a/Berksfile b/Berksfile | |
index c4bb297..6d86dcf 100644 | |
--- a/Berksfile | |
+++ b/Berksfile | |
@@ -1,3 +1,4 @@ | |
site :opscode | |
metadata | |
+cookbook 'git' |
This file contains 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
--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 |
This file contains 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
$ gem install berkshelf | |
$ vagrant plugin install vagrant-berkshelf |
This file contains 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
$ 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 |
This file contains 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
$ vagrant reload |
This file contains 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
$ cd precise | |
$ git add . | |
$ git commit -a -m 'Initial commit' |
This file contains 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
$ vim Vagrantfile |
This file contains 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
$ vagrant up | |
$ vagrant ssh |
This file contains 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
$ vim Berksfile |
This file contains 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
$ vim Vagrantfile |
This file contains 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
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