Ansible role for installing new relic php agent on CentOS 7.
- Support multiple php installations
- Complete control over
newrelic.ini
configuration - Support for uninstallting the agent
This role is still in early states of development, so issues are very possible. Comments and pull reqeusts are welcome !
Using ansible-galaxy
:
ansible-galaxy install visdmin.ansible-new-relic-php-agent
Using git
:
git clone https://github.com/visdmin/ansible-new-relic-php-agent.git
Using requirements.yml
:
- src: visdmin.ansible-new-relic-php-agent
- Role currenlty only has support for
CentOS 7
. - Working php installation on taget host
- New relic license key help here: docs.newrelic.com
present
: Install new-relic php agent or keep the current version, and configure it.latests
: Keep new-relic php agent up to date, and configure it.absent
: Uninstall new-relic php agent, repository, and configurations.
anrpa_php_installations: # List of php installations (required)
# php installation #1
- appname: "my app" # Aplication name (required)
license: "123123810923789018283" # New relic license key (required)
bin_path: "/opt/remi/php74/root/bin/" # Path to the `php` executable (required)
config_path: "/etc/opt/remi/php74/php.d/" # Path to `php` config directory (required)
# php installation #2
- appname: "another app"
license: "adaw213131321"
#...
# php installation #n
appname
: application name: help: name-your-php-applicationlicense
: new relic license key: help: new-relic-api-keys/#ingest-license-keybin_path
: directory that contains thephp
executableconfig_path
: direcotry wherephp
configuration is located (php.d/
)
state
: [present | absent] can be used to disable php single installation (removes the .ini file for the installation)php_fpm_service_name
: php-fpm service name to be restarted when php configuration changes are done.web_server_service_name
: web-server service name to be restarted when php configuration changes are done.ini
: newrelic.ini configuration variables
- Before overwriting
newrelic.ini
variables inini:
section make sure that you understand what you are doing. - Changing the .ini values could cause security flaws with the installation !
- Help with indivial variabled: https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration/
anrpa_new_relic_repo_name
: new-relic yum repository nameanrpa_new_relic_64bit_repo_url
: new-relic yum repository url for 64-bit systemsanrpa_new_relic_32bit_repo_url
: new-relic yum repository url for 32-bit systemsanrpa_php_agent_package_name
: new-relic php agent package nameanrpa_php_agent_service_name
: new-relic php agent service nameanrpa_php_ini_filename
: new-relic php.ini file name
Variable example:
anrpa_installation_state: latest
anrpa_php_installations:
- appname: My php 7.4 installation 1
license: awdbk12312adawd12312kadwaw2132
bin_path: /opt/remi/php74/root/bin/
config_path: /etc/opt/remi/php74/php.d/
php_fpm_service_name: php74-php-fpm
web_server_service_name: nginx
# newrelic.ini configuration:
ini:
enabled: true
logfile: "/var/log/newrelic/php_agent.log"
loglevel: "info"
high_security: false
process_host.display_name: ""
daemon.logfile: "/var/log/newrelic/newrelic-daemon.log"
daemon.loglevel: "info"
#...
- appname: My php 7.2 installation
license: awdbk12312adawd12312kadwaw2132
bin_path: /opt/remi/php72/root/bin/
config_path: /etc/opt/remi/php72/php.d/
php_fpm_service_name: php72-php-fpm
web_server_service_name: apache
# newrelic.ini configuration:
ini:
enabled: true
logfile: "/var/log/newrelic/php_agent.log"
loglevel: "info"
high_security: false
process_host.display_name: ""
daemon.logfile: "/var/log/newrelic/newrelic-daemon.log"
daemon.loglevel: "info"
#...
---
- hosts: all
vars:
anrpa_installation_state: latest
anrpa_php_installations:
- appname: my application
license: awdbk12312ada2wd12312kadwaw2132
bin_path: /opt/remi/php74/root/bin/
config_path: /etc/opt/remi/php74/php.d/
php_fpm_service_name: php74-php-fpm
web_server_service_name: nginx
ini:
framework: symfony2
roles:
- visdmin.ansible-new-relic-php-agent
---
- hosts: all
vars:
anrpa_installation_state: absent
anrpa_php_installations:
- appname: my application
license: awdbk12312ada2wd12312kadwaw2132
bin_path: /opt/remi/php74/root/bin/
config_path: /etc/opt/remi/php74/php.d/
php_fpm_service_name: php74-php-fpm
web_server_service_name: nginx
ini:
framework: symfony2
roles:
- visdmin.ansible-new-relic-php-agent
---
- hosts: all
become: true
vars:
anrpa_installation_state: latest
anrpa_php_installations:
- appname: php-7.4
license: 123123981awdawd0293129
bin_path: /opt/remi/php74/root/bin/
config_path: /etc/opt/remi/php74/php.d/
php_fpm_service_name: php74-php-fpm
web_server_service_name: nginx
- appname: php-7.2
license: 123123981awdawd0293129
bin_path: /opt/remi/php72/root/bin/
config_path: /etc/opt/remi/php72/php.d/
php_fpm_service_name: php72-php-fpm
web_server_service_name: nginx
roles:
- visdmin.ansible-new-relic-php-agent
---
- hosts: all
vars:
anrpa_installation_state: latest
anrpa_installation_state.php_installations:
- appname: my application
license: awdbk12312adawd3212312kadwaw2132
bin_path: /usr/bin/
config_path: /etc/php.d/
php_fpm_service_name: php-fpm
roles:
- visdmin.ansible-new-relic-php-agent
MIT