stacktonic.nr_infra
Ansible Role for New Relic Infrastructure Agent 
This role sets up the New Relic infrastructure agent on your system.
Remember, this role is basic and serves as a starting point for your own custom setup.
Installing and Using the Ansible Role
What newrelic-infra
Does
- Adds New Relic's software package repository.
- Installs and configures the New Relic infrastructure agent.
Getting Started
To begin, include this role in your playbook and change the necessary variables.
You can manage the newrelic-infra
through role configuration.
Install the Infrastructure Agent
Use this example to install the agent.
---
- hosts: ap_ne_1
roles:
- name: newrelic.newrelic-infra
vars:
nrinfragent_config:
license_key: YOUR_LICENSE_KEY
log_file: /var/log/nr-infra.log
log_to_stdout: false
Reference
Role Configuration
Variables
nrinfragent_config
(Required)
This is used to set up the agent's configuration. You must provide license_key
. Check the New Relic documentation for current options.
nrinfragent_state
(Optional)
Indicates what action to take with the agent:
'latest'
- [default] install the newest version of the agent. Also meanspresent
.'absent'
- Uninstall the agent.
nrinfragent_os_name
(Optional)
Specifies the operating system where the agent will be installed. Default is ansible_os_family
. Find supported operating systems in the meta/main.yml
file.
nrinfragent_os_version
(Optional)
Specifies the OS version for the installer package needed for this machine. Default is ansible_lsb.major_release
. Mainly used for RedHat
systems.
nrinfragent_os_codename
(Optional)
Specifies the OS codename for the installer package. Default is ansible_lsb.codename
. Mainly used for Debian
systems.
nrinfragent_choco_version
(Optional)
Indicates which version of the Chocolatey package to install newrelic-infra
on Windows.
nrinfragent_service_state
(Optional)
Sets the state of the newrelic-infra
service after installation. Default is started
, meaning the service will run. Change to stopped
if you want to install it without starting right away.
nrinfragent_service_enabled
(Optional)
Specifies if the service will start when the system boots. Defaults to yes
; change to no
to prevent automatic start.
nrinfragent_integrations
(Optional)
Lists the infrastructure integrations to install. You can find available integrations here.
Each integration should include its name
and state
. The package name is in the Install and activate section of the integrations docs. Each name starts with nri-
(e.g., nri-apache
, nri-redis
).
By default, the state is absent
, which means the package won't install; you can set it to latest
or present
. For example:
nrinfragent_integrations:
- { name: nri-nginx, state: "latest" }
- { name: nri-mysql, state: "absent" }
The code for each integration is on New Relic's GitHub.
Removing the newrelic-infra-integrations
Package
This only applies if you have the
newrelic-infra-integrations
package installed
To remove the newrelic-infra-integrations
package or bundled integrations (like nri-redis, nri-cassandra, etc.), add newrelic-infra-integrations
as the first item in nrinfragent_integrations
with the state absent
.
nrinfragent_integrations:
- { name: newrelic-infra-integrations, state: "absent" }
Deprecated
You can specify the license key for compatibility. It's recommended to use license_key
in nrinfragent_config
instead. If both are specified, the one in nrinfragent_config
takes priority.
Compatibility
Supported Platforms
- RHEL/CentOS
- RHEL/CentOS 8
- RHEL/CentOS 7
- RHEL/CentOS 6
- RHEL/CentOS 5
- Ubuntu
- 18 Bionic
- 16 Xenial
- 14 Trusty
- 12 Precise
- Debian
- 10 Buster
- 9 Stretch
- 8 Jessie
- 7 Wheezy
- SUSE Linux Enterprise
- 12
- Windows
- All
- Note: Windows support depends on the third-party newrelic-infra Chocolatey package, which is maintained by third parties.
Releasing to Ansible Galaxy
To release a new version to Ansible Galaxy, do the following:
- Update the CHANGELOG.md
- Create a new GitHub release.
- Ensure the version is visible on Ansible Galaxy. If there's an issue, contact a project owner.
Support
If you need help with New Relic products, there are many support tools and channels available.
For confirmed bugs or feature requests, please file a GitHub issue.
Support Channels
- New Relic Documentation: Detailed guidance on using the platform
- New Relic Community: Best place for troubleshooting questions
- New Relic Developer: Resources for building custom observability tools
- New Relic University: Online training for all New Relic users
- New Relic Technical Support 24/7/365 ticketed support. Learn about our Technical Support Offerings.
Privacy
New Relic values your privacy and security and is committed to protecting your information. It’s important not to share personal data in public, and users should remove sensitive information from logs and diagnostics.
“Personal Data” includes any information about an identifiable person, such as your name, phone number, address, device ID, IP address, and email.
For more details, see New Relic’s General Data Privacy Notice.
Contribute
We welcome your contributions to improve this project! When submitting a pull request, you must sign the CLA using CLA-Assistant. You only need to do this once per project.
For any questions, or to execute the corporate CLA, email us at opensource@newrelic.com.
Note about vulnerabilities
As outlined in our security policy, New Relic prioritizes the privacy and security of our customers. We believe in collaborating with security researchers for coordinated disclosures.
If you find a security vulnerability, we appreciate you reporting it to New Relic via HackerOne.
If you’d like to contribute to this project, please review these guidelines.
We thank all contributors! This project wouldn’t be what it is today without your help.
License
The infrastructure-agent-ansible is licensed under the Apache 2.0 License.
Role to install New Relic Infrastructure agent
ansible-galaxy install stacktonic.nr_infra