You can use New Relic's Ansible role to help you scale your New Relic Observability efforts using the New Relic CLI and New Relic Open Installation repository. For instructions on how to use Ansible, see the Ansible documentation. This is a community-supported effort.
Want to configure the infrastructure agent using Ansible? Create a New Relic account for free! No credit card required.
This role will always install the latest released version of the New Relic agent and doesn't support installing older versions.
New Relic provides configuration management sample code to help you install our infrastructure monitoring agent using workflows and tools that are common with many Ops teams. This is a basic Ansible role and is intended to be used as a starting place for creating your own customized workflow.
Configuration depends on your specific setup and standards. To view an Ansible sample role and more integration information, see the Ansible Galaxy documentation.
The Ansible role with New Relic's infrastructure monitoring agent requires a supported operating system.
This role is tested with the Ansible Core 2.13 and 2.14 and Python 3.10. Ansible Core versions before 2.10 are not supported.
$ansible-galaxy install newrelic.newrelic_install
Make sure you have
ansible.utils if they are not already installed:
$ansible-galaxy collection install ansible.windows ansible.utils
If you want to use a local copy of the role, clone the repo and run
make in the project root to copy this repo to
~/.ansible/roles/newrelic.newrelic_install, enabling the role to behave as though it were installed from Galaxy.
To get started using the role
- Include the role in your playbook.
- Customize the required variables.
After installing, include the
newrelic.newrelic_install role in a new or existing playbook. Here is an example of configuring your role to install the infrastructure agent:
---- name: Install New Relichosts: allroles:- role: newrelic.newrelic_installvars:targets:- infrastructure- logstags:foo: barenvironment:NEW_RELIC_API_KEY: <API key>NEW_RELIC_ACCOUNT_ID: <Account ID>NEW_RELIC_REGION: <Region>
Here are available variables for configuring the
List of targeted installs to run on hosts. Available options are:
Key-value pairs of tags passed to the installation.
Sets timeout for installation task. Overrides the default timeout of 600s.
Verbosity options for the installation (
Set in defaults/main.yml:
Values are set under the
environment keyword in your playbook:
NEW_RELIC_REGION(optional: 'US' or 'EU', default 'US')
Additionally, you can set an optional
HTTPS_PROXY variable to enable a proxy for your installation.
See ansible's remote environment for more info.
infrastructure, and an error will be thrown if
logsis specified without
apm-nodejsagent installation is supported only for apps managed by PM2. To install the agent using a package manager such as
yarnor via other installation paths, please reference our docs.
apm-dotnetagent installation for Windows is supported only for apps hosted by IIS. Linux installations are only supported for .NET applications which run as a
apm-javaagent installation supports Java running in Tomcat, Wildfly/Jboss, and Jetty (standalone).
- The following integrations require the infrastructure agent to be installed:
- name: Install New Relichosts: allroles:- role: newrelic.newrelic_installvars:targets:- infrastructure- logs- apm-phptags:foo: barinstall_timeout_seconds: 1000verbosity: debugenvironment:NEW_RELIC_API_KEY: <API key>NEW_RELIC_ACCOUNT_ID: <Account ID>NEW_RELIC_REGION: <Region>NEW_RELIC_APPLICATION_NAME: "My Application"HTTPS_PROXY: "http://my.proxy:8888"