[chef] How to invoke another recipe with notifies


Chronological Thread 
  • From: "jeffty" < >
  • To: < >
  • Subject: [chef] How to invoke another recipe with notifies
  • Date: Fri, 9 Oct 2015 00:59:46 +0800

Hi All,

 

I have two recipe check_out_code.rb and deploy.rb and want to sync code from git, and them deploy the code to server if the sync successfully (which means that some code in this git project has been changed).

 

In check_out_code.rb:

 

git node['git_project_directory’] do

    repository  git_url

    action :sync

    notifies :run, "how to call the deploy recipe here?", :immediately

end

 

And in deploy.rb the updated file in the git project directory will be deployed to server once a synchronization is performed successfully.

 

Is it possible? If not maybe we need to define a global variable like:

 

synced = false

 

And change it to true if git sync succeeded. Then

 

if synced then

  include_recipe “mytest::deploy”

end

 

But this seems not work either in the git resource.

 

Thanks & Regards

Jason




Archive powered by MHonArc 2.6.16.

§