Skip to content

Instantly share code, notes, and snippets.

@meg23
Created March 1, 2015 23:04
Show Gist options
  • Save meg23/00fc1edf26502fc2cd99 to your computer and use it in GitHub Desktop.
Save meg23/00fc1edf26502fc2cd99 to your computer and use it in GitHub Desktop.
---
- hosts: all
tasks:
- set_fact: newrelic_version="2.0.2.111"
- name: Creating 'bin' directory in local user directory
file: path=~/bin state=directory
- name: Creating 'etc' directory in local user directory
file: path=~/etc state=directory
- name: Creating 'newrelic' directory in local user 'etc' directory
file: path=~/etc/newrelic state=directory
- name: Creating 'logs' directory in local user directory
file: path=~/logs state=directory
- name: Creating 'newrelic' directory in local user 'logs' directory
file: path=~/logs/newrelic state=directory
- name: Download 'other' newrelic agent for manual install
get_url: url=http://download.newrelic.com/server_monitor/release/newrelic-sysmond-{{ newrelic_version }}-linux.tar.gz dest=./newrelic-sysmond-{{ newrelic_version }}-linux.tar.gz
- name: Unarchiving newrelic agent
unarchive: src=newrelic-sysmond-{{ newrelic_version }}-linux.tar.gz dest=./ copy=no
- name: Get architecture of target system (x86 or x64)
action: shell uname -m | sed 's/86_//g' | sed 's/i6/x/g'
register: arch
- name: Installing nrsysmond to target system
action: shell cp newrelic-sysmond-{{ newrelic_version }}-linux/daemon/nrsysmond.{{ arch.stdout }} bin/nrsysmond
- name: Installing config file for newrelic
action: shell cp newrelic-sysmond-{{ newrelic_version }}-linux/nrsysmond.cfg ~/etc/newrelic/nrsysmond.cfg
- name: Set newrelic key in nrsysmond.cfg
action: shell sed -i "s/REPLACE_WITH_REAL_KEY/{{ newrelic_key }}/g" ~/etc/newrelic/nrsysmond.cfg
- name: Starting newrelic agent
command: ~/bin/nrsysmond -c ~/etc/newrelic/nrsysmond.cfg -l ~/logs/newrelic/newrelic.log
async: 15
poll: 0
- name: Removing zipped and extracted folders for installation
action: shell rm -rf newrelic-sysmond-2.0.2.111-linux*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment