[chef] RE: How to invoke another recipe with notifies

Chronological Thread 
  • From: "jeffty" < >
  • To: "'Lamont Granquist'" < >, < >
  • Subject: [chef] RE: How to invoke another recipe with notifies
  • Date: Fri, 9 Oct 2015 13:23:25 +0800

Thanks Lamont.


Then is it possible to modify an attribute in the chef resource then?




From: Lamont Granquist [mailto:
Sent: Friday, October 09, 2015 6:18 AM
Cc: jeffty < >
Subject: Re: [chef] How to invoke another recipe with notifies


You can't notify a recipe, you can only notify resources.  It may be worthwhile to package your recipe up as an LWRP so that the recipe itself is just a call to the LWRP, then notify the LWRP from the other code.

On 10/08/2015 09:59 AM, jeffty wrote:

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



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”



But this seems not work either in the git resource.


Thanks & Regards



Archive powered by MHonArc 2.6.16.