以下の内容はhttps://tbpgr.hatenablog.com/entry/20131204/1386168314より取得しました。


Chef | Subscribeで他のリソースをトリガーに任意のアクションを実行する

概要

Subscribeで他のリソースをトリガーに任意のアクションを実行する

詳細

Subscribeで他のリソースをトリガーに任意のアクションを実行します。

resource "some_resource" do
  # options
  subscribes :action, "target_resource"
end

詳細については公式サイトリンクを参照。
http://docs.opscode.com/resource_common.html#subscribes-syntax

サンプル

コード

takuhaiをインストールした際にexecute[notification_sample]を呼び出され、
execute[notification_sample]が呼び出された際に
execute[subscript_sample]が呼び出される。

execute "notification_sample" do
  command "echo notification!!!!! > /home/vagrant/notification.txt"
end

execute "subscript_sample" do
  command "echo subscribe!!!!! > /home/vagrant/subscribe.txt"
  notifies :run, "execute[notification_sample]"
end

gem_package "takuhai" do
  action :install
  version "0.0.1"
  notifies :run, "execute[notification_sample]"
end
実行結果確認
$ pwd
/home/vagrant
$ cat subscribe.txt
subscribe!!!!!



以上の内容はhttps://tbpgr.hatenablog.com/entry/20131204/1386168314より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14