Commit 86242ce7 by Arbab Nazar

Merge pull request #3092 from edx/arbab/newrelic-rewrite

YAML style parameters passing
parents b0323eb2 fd101d08
...@@ -21,6 +21,8 @@ NEWRELIC_DEBIAN_KEY_ID: '548C16BF' ...@@ -21,6 +21,8 @@ NEWRELIC_DEBIAN_KEY_ID: '548C16BF'
NEWRELIC_DEBIAN_KEY_URL: 'https://download.newrelic.com/{{ NEWRELIC_DEBIAN_KEY_ID }}.gpg' NEWRELIC_DEBIAN_KEY_URL: 'https://download.newrelic.com/{{ NEWRELIC_DEBIAN_KEY_ID }}.gpg'
NEWRELIC_LICENSE_KEY: "SPECIFY_KEY_HERE" NEWRELIC_LICENSE_KEY: "SPECIFY_KEY_HERE"
NEWRELIC_AMAZON_REPO: 'https://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm'
# #
# OS packages # OS packages
# #
...@@ -30,3 +32,4 @@ newrelic_debian_pkgs: ...@@ -30,3 +32,4 @@ newrelic_debian_pkgs:
newrelic_redhat_pkgs: newrelic_redhat_pkgs:
- newrelic-sysmond - newrelic-sysmond
---
- name: restart newrelic-logwatch-agent
service: name=newrelic-logwatch-agent state=restarted
...@@ -25,37 +25,43 @@ ...@@ -25,37 +25,43 @@
# roles: # roles:
# - newrelic # - newrelic
- name: add apt key - name: Add apt key for New Relic
apt_key: > apt_key:
id="{{ NEWRELIC_DEBIAN_KEY_ID }}" url="{{ NEWRELIC_DEBIAN_KEY_URL }}" id: "{{ NEWRELIC_DEBIAN_KEY_ID }}"
state=present url: "{{ NEWRELIC_DEBIAN_KEY_URL }}"
state: present
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: Configure the New Relic Servers yum repository - name: Install apt repository for New Relic
shell: > apt_repository:
rpm -Uvh https://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm repo: "{{ NEWRELIC_DEBIAN_REPO }}"
creates=/etc/yum.repos.d/newrelic.repo state: present
when: ansible_distribution == 'Amazon' update_cache: yes
- name: install apt repository
apt_repository: repo="{{ NEWRELIC_DEBIAN_REPO }}" update_cache=yes
when: ansible_distribution == 'Ubuntu'
- name: install newrelic agent (apt)
apt: pkg="newrelic-sysmond"
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: Install newrelic related system packages for Ubuntu - name: Install newrelic related system packages for Ubuntu
apt: pkg={{ item }} install_recommends=yes state=present apt:
with_items: newrelic_debian_pkgs name: "{{ item }}"
install_recommends: yes
state: present
with_items: "{{ newrelic_debian_pkgs }}"
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: Configure the New Relic Servers yum repository
yum:
name: "{{ NEWRELIC_AMAZON_REPO }}"
state: present
when: ansible_distribution == 'Amazon'
- name: Install newrelic related system packages for Amazon - name: Install newrelic related system packages for Amazon
yum: pkg={{ item }} state=present yum:
with_items: newrelic_redhat_pkgs name: "{{ item }}"
state: present
update_cache: yes
with_items: "{{ newrelic_redhat_pkgs }}"
when: ansible_distribution == 'Amazon' when: ansible_distribution == 'Amazon'
- name: configure the agent - name: Configure the agent
template: template:
src: "etc/newrelic/nrsysmond.cfg.j2" src: "etc/newrelic/nrsysmond.cfg.j2"
dest: "/etc/newrelic/nrsysmond.cfg" dest: "/etc/newrelic/nrsysmond.cfg"
...@@ -63,5 +69,8 @@ ...@@ -63,5 +69,8 @@
group: "newrelic" group: "newrelic"
mode: 0640 mode: 0640
- name: ensure started and enabled - name: Ensure started and enabled
service: name=newrelic-sysmond state=restarted enabled=yes service:
name: newrelic-sysmond
state: restarted
enabled: yes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment