Configure New Relic Infrastructure using Ansible

This document provides basic information for how to use New Relic's Ansible role to install and configure New Relic Infrastructure. For instructions on how to use Ansible, see the Ansible documentation. This is a community-supported effort.

Description

New Relic provides source-available, configuration management sample code to help you install the New Relic Infrastructure agent using workflows and tools that are common with many Ops teams. To view an Ansible sample role and more integration information, see the Ansible Galaxy.

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.

Compatibility and requirements

The Ansible role with New Relic Infrastructure requires a supported Linux operating system.

Setup

The newrelic.newrelic-infra role:

  • Adds the New Relic Infrastructure package repository source.
  • Installs and configures the New Relic Infrastructure agent.

To get started using this role:

  1. Include the role in your playbook.
  2. Customize the required variables.

Use and install

All typical interactions with newrelic.newrelic-infra use role configuration. Here is an example of configuring your role to install the Infrastructure agent:

- hosts: ap_northeast_1
  roles:
    - name: newrelic.newrelic-infra
      vars:
        nrinfragent_os_name: YOUR_OS_NAME
        nrinfragent_os_version: YOUR_OS_VERSION
        nrinfragent_config:
          license_key: YOUR_LICENSE_KEY
          log_file: /var/log/newrelic/nr-infra.log
          log_to_stdout: false

Role configuration variables

Here are available variables for configuring the newrelic.newrelic-infra role:

Variable Description
nrinfragent_config Required. A map of key-value pairs. Corresponds directly with the available general configuration settings.
nrinfragent_state

Describes what you want to do with the agent:

  • 'latest': Default. Installs the latest version of the Infrastructure agent.
  • 'absent': Uninstall the agent.
nrinfragent_version

The version of the agent you want to install:

  • '*': Default. Installs the latest version of the Infrastructure agent.
  • 'x.y.zzz': String specifying a specific agent version number you want to install; for example, 1.0.682.
nrinfragent_os_name

Specifies the target OS that the Infrastructure agent will be installed on. See the meta/main.yml file for the latest list.

nrinfragent_os_version

Specifies the OS version of the installer package needed for this machine. See the meta/main.yml file for the latest list.

For more help

If you need additional help, file an issue at newrelic/infrastructure-agent-ansible on GitHub.

Recommendations for learning more: