-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install New Relic infrastructure agent #900
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: restart newrelic_infra | ||
service: | ||
name: "newrelic-infra.service" | ||
state: restarted |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
|
||
- name: Download installer | ||
ansible.builtin.get_url: | ||
url: "https://download.newrelic.com/install/newrelic-cli/scripts/install.sh" | ||
dest: "/tmp/new-relic-install.sh" | ||
mode: "777" | ||
|
||
- name: Install New Relic command | ||
ansible.builtin.command: "/tmp/new-relic-install.sh" | ||
args: | ||
creates: /usr/local/bin/newrelic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to see some validation of the result.
But I don't think it's worth spending more effort on figuring one of those out. |
||
|
||
- name: Install New Relic agent | ||
command: /usr/local/bin/newrelic install -y | ||
environment: | ||
NEW_RELIC_API_KEY: "{{ new_relic_api_key }}" | ||
NEW_RELIC_ACCOUNT_ID: "{{ new_relic_account_id }}" | ||
NEW_RELIC_REGION: "{{ new_relic_region }}" | ||
args: | ||
creates: /usr/bin/newrelic-infra | ||
|
||
- name: Use our standard names in dashboard | ||
lineinfile: | ||
name: "/etc/newrelic-infra.yml" | ||
line: "display_name: {{ host_id }}" | ||
regex: "^display_name:" | ||
state: present | ||
notify: restart newrelic_infra | ||
Comment on lines
+23
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice one! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This role also depends on
new_relic_account_id
andnew_relic_region
, so I was wondering if we should check for those here too.But then if you forgot to set any of those, it would just silently fail.
👍 So I think this way is best: if you intended to switch it on, but left out a detail, then it would be better to get an error message which shows what's missing.