vagrant と knife-solo を始めるときのコマンド
いっつも忘れるのでメモっておく
ホスト名をvagrant-ubuntu14.04にした際の例
# vagrant に box 追加 % vagrant box add ubuntu-14.04 https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box % mkdir ubuntu-14.04-server % cd ubuntu-14.04-server % vagrant init ubuntu-14.04-server # Vagrantfile の config.vm.network "private_network", ip: "192.168.33.10" は コメントを外しておく % vagrant up % vagrant ssh-config --host vagrant-ubuntu14.04 >> ~/.ssh/config % bundle init % echo "gem 'knife-solo'" >> Gemfile % echo "gem 'berkshelf'" >> Gemfile % bundle install % bundle exec knife solo init . % echo 'source "https://api.berkshelf.com"' >> Berksfile # 使用するレシピをBerkfileに追加しておく % echo 'cookbook "java"' >> Berksfile % bundle exec berks vendor # 用途に合わせて作成(ここではjenkinsクックブックを作っている) % bundle exec knife cookbook create jenkins -o site-cookbooks # もし依存するレシピがあれば metadata.rb に追記しておく % echo "depends 'java'" >> site-cookbooks/jenkins/metadata.rb # site-cookbooks/クックブック名/recipes/default.rb をよしなに編集しておく # knife solo の本実行の前に nodes に追加 % bundle exec knife solo prepare vagrant-ubuntu14.04 # nodes/vagrant-ubuntu14.04.json の run_list をよしなに追加しておく # knife soloを実行 % bundle exec knife solo cook vagrant-ubuntu14.04