LoginSignup
3
3

More than 5 years have passed since last update.

自分で作成したcookbookをVagrantで適用する

Last updated at Posted at 2014-07-06

自分でcookbookを作る

自分で作ったcookbookはsite-cookbooksに置きます。

yum -y updateを実行するcookbookを作る

cookbookの作成

yum-updateという名前でcookbookを作ります。

knife cookbook create yum-update -o site-cookbooks/

recipeの作成

site-cookbooks/yum-update/recipes/default.rbを編集します。
ここに実行する内容を記述します。

default.rb
yum_package "yum-fastestmirror" do
  action :install
end

execute "yum-update" do
  user "root"
  command "yum -y update"
  action :run
end

recipeに追加

Vagrantfileにrecipeを追加します。

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
    chef.add_recipe "yum-update"
  end

vagrant起動

vagrant up

リンク

Vagrant初期設定
自分で作成したcookbookをVagrantで適用する
VagrantでCentOS外部レポジトリの追加
Vagrant仮想マシン上にMySQL5.5インストール
Vagrant仮想マシン上のMySQLに接続
Vagrant仮想マシン上にredis2.8.12インストール

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3