diff --git a/newrelic-php/defaults/main.yml b/newrelic-php/defaults/main.yml new file mode 100644 index 00000000..8d498aab --- /dev/null +++ b/newrelic-php/defaults/main.yml @@ -0,0 +1,3 @@ +--- +newrelic_license: "" +newrelic_app_name: "" diff --git a/newrelic-php/tasks/main.yml b/newrelic-php/tasks/main.yml new file mode 100644 index 00000000..aa9a2690 --- /dev/null +++ b/newrelic-php/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- include_role: + name: newrelic-sources + +- name: Pre-seed package configuration with app name + debconf: + name: newrelic-php5 + question: "newrelic-php5/application-name" + value: "{{ newrelic_app_name }}" + vtype: string + when: newrelic_app_name != "" + +- name: Pre-seed package configuration with license + debconf: + name: newrelic-php5 + question: "newrelic-php5/license-key" + value: "{{ newrelic_license }}" + vtype: "string" + when: newrelic_license != "" + +- name: Install package for PHP + apt: + name: newrelic-php5 diff --git a/newrelic-sources/files/548C16BF.gpg b/newrelic-sources/files/548C16BF.gpg new file mode 100644 index 00000000..ff7f2c0a --- /dev/null +++ b/newrelic-sources/files/548C16BF.gpg @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +mQGiBEwppkIRBACJJHcIXVJP5orJE7nVEcvg+++Hp+THir3aO+BGa73/pJ03hZ5H +laodveU5eQALiBxYXegHKS+umwXxQg8T+Pxma4U3W6xU0JnVYggcfL1xa763wlP3 +aKdlHfUvVBuVhnmvYPWf3iCzYM92Ia/i/q2NvVMjpOOkp9bcIcfBHqS80wCgjWPA +iC9Qi0zaWkTOC3CKMCLDtgkD/32dmFp5USY7ofmUnKlW7EjJGV1GCNF7CDGLqQVY +k0CncTctbRYJWOCyGS8zAiyhtTD4kypNWnlSuas6CbvC4uxcOzKCaEQqJRMHhtfj +tGghJDb5azGF5yjn7ITUycqRgL3/YeX078EPhaVJCFHh7ImYhRgD1unf6fwrabP8 +NCOYA/9F5p3qpWUfg32MKv6IWWYUWzUjpR1wB47cbntSNA14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oJELMb +KeVUjBa/eYwAn0RvMzThAN8cu/CVed+vFrJSPgV1AJ9xq5bh7yYudyD71iYKSL7G +lth9GQ== +=TriU +-----END PGP PUBLIC KEY BLOCK----- diff --git a/newrelic-sources/handlers/main.yml b/newrelic-sources/handlers/main.yml new file mode 100644 index 00000000..0a402c8b --- /dev/null +++ b/newrelic-sources/handlers/main.yml @@ -0,0 +1,10 @@ +--- + +- name: Reload Squid + service: + name: squid3 + state: reloaded + +- name: apt update + apt: + update_cache: yes diff --git a/newrelic-sources/tasks/main.yml b/newrelic-sources/tasks/main.yml new file mode 100644 index 00000000..5a8ecf6b --- /dev/null +++ b/newrelic-sources/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- name: Add dotdeb GPG key + apt_key: + # url: https://download.newrelic.com/548C16BF.gpg + data: "{{ lookup('file', '548C16BF.gpg') }}" + +- name: Append packages.dotdeb.org to Squid whitelist + lineinfile: + name: /etc/squid3/whitelist-custom.conf + line: "http://apt.newrelic.com/.*" + notify: Reload Squid + +- meta: flush_handlers + +- name: Install NewRelic repository + apt_repository: + repo: "deb http://apt.newrelic.com/debian/ newrelic non-free" + state: present + filename: newrelic + +- meta: flush_handlers diff --git a/newrelic-sysmond/defaults/main.yml b/newrelic-sysmond/defaults/main.yml new file mode 100644 index 00000000..e2d18908 --- /dev/null +++ b/newrelic-sysmond/defaults/main.yml @@ -0,0 +1,2 @@ +--- +newrelic_license: "" diff --git a/newrelic-sysmond/handlers/main.yml b/newrelic-sysmond/handlers/main.yml new file mode 100644 index 00000000..5f5a2562 --- /dev/null +++ b/newrelic-sysmond/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: restart newrelic-sysmond + systemd: + name: newrelic-sysmond + state: restarted diff --git a/newrelic-sysmond/tasks/main.yml b/newrelic-sysmond/tasks/main.yml new file mode 100644 index 00000000..a586efbf --- /dev/null +++ b/newrelic-sysmond/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- include_role: + name: newrelic-sources + +- name: Install system monitor daemon + apt: + name: newrelic-sysmond + +- name: Set license key for newrelic-sysmond + replace: + dest: /etc/newrelic/nrsysmond.cfg + regexp: "license_key=REPLACE_WITH_REAL_KEY" + replace: "license_key={{ newrelic_license }}" + when: newrelic_license != "" + notify: restart newrelic-sysmond