[chef] Re: notifications / subscribe: different cookbook


Chronological Thread 
  • From: AJ Christensen < >
  • To: chef < >
  • Subject: [chef] Re: notifications / subscribe: different cookbook
  • Date: Fri, 25 Jan 2013 12:38:50 +1300

The resource for the template needs to be created before the service
is instantiated, using that syntax for subscribes.

If you use the newer syntax, this restriction does not apply e.g.;

subscribes :create, "template[#{node['pam_limits']['config']}]",
:immediately # I think this will work

It looks like you're missing the 'include_recipe' that creates the
node['pam_limits']['config'] template, anyway..

Cheers,

AJ

On 25 January 2013 12:22, Andrey Brindeyev 
< >
 wrote:
> Hi!
>
> Is it possible to refer a template from different cookbook?
>
> I'm trying to implement a general pam_limits cookbook for managing
> /etc/security/limits.conf file.
>
> This was idea how it can be used in other cookbooks:
>
> node.set['pam_limits']['domains'][tomcat7user]['-']['nprocs'] = 2048
>
> service "tomcat7" do
>     service_name "tomcat7"
>     action :start
>     subscribes :create, resources(:template =>
> node['pam_limits']['config']), :immediately
> end
>
> When I tried to run it, I got expected error:
>
> Cannot find a resource matching template[/etc/security/limits.conf] (did you
> define it first?)
>
> How can I do that in Chef?
>
> Andrey.



Archive powered by MHonArc 2.6.16.

§