Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Created May 3, 2017 09:23
Show Gist options
  • Select an option

  • Save jacoelho/fdf31f86a822bc0b55edc594b25d8539 to your computer and use it in GitHub Desktop.

Select an option

Save jacoelho/fdf31f86a822bc0b55edc594b25d8539 to your computer and use it in GitHub Desktop.
chef voodoo resources
%w(nginx php-fpm).each do |name|
begin
r = find_resource!(:service, name)
r.subscribes(:restart, [
"file[/etc/newrelic/newrelic.cfg]",
"file[/etc/php.d/newrelic.ini]"]
)
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.error("newrelic_apm service #{name} not found, skipping restart")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment