Created
August 25, 2021 11:06
-
-
Save jlis/31c075cab09564369e018e87f6b0bab3 to your computer and use it in GitHub Desktop.
Install New Relic PHP Agent via Chef recipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: <INSERT COOKBOOK NAME> | |
# Recipe:: new_relic_agent | |
# | |
# Add apt repo | |
apt_repository 'newrelic' do | |
uri 'http://apt.newrelic.com/debian' | |
key 'https://download.newrelic.com/548C16BF.gpg' | |
components ['non-free'] | |
distribution 'newrelic' | |
end | |
# Preseed application name | |
execute "preseed application name" do | |
command "echo 'newrelic-php5 newrelic-php5/application-name <INSERT APPLICATION NAME>' | debconf-set-selections" | |
action :run | |
end | |
# Preseed liense key | |
execute "preseed license key" do | |
command "echo 'newrelic-php5 newrelic-php5/license-key string #{node[:custom][:newrelic][:license_key]}' | debconf-set-selections" | |
action :run | |
end | |
# Install the apt package | |
package 'newrelic-php5' | |
# Start if not existent + reload php5-fpm | |
service "php#{node[:custom][:php][:version]}-fpm" do | |
only_if { ::File.exists?("/etc/init.d/php#{node[:custom][:php][:version]}-fpm") } | |
ignore_failure true | |
action [:start, :reload] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment