From 13b4fbb6bb3d838538729bb8fea72f03abf3ba9b Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 13 Jul 2017 15:57:42 +0200 Subject: [PATCH] Newrelic: merge roles --- newrelic-php/README.md | 14 ---------- newrelic-php/meta/main.yml | 19 ------------- newrelic-sources/.kitchen.yml | 28 ------------------- newrelic-sources/README.md | 9 ------ newrelic-sources/meta/main.yml | 19 ------------- newrelic-sources/tests/test.yml | 4 --- newrelic-sysmond/.kitchen.yml | 28 ------------------- newrelic-sysmond/README.md | 13 --------- newrelic-sysmond/defaults/main.yml | 2 -- newrelic-sysmond/handlers/main.yml | 6 ---- newrelic-sysmond/tests/test.yml | 4 --- {newrelic-php => newrelic}/.kitchen.yml | 0 newrelic/README.md | 17 +++++++++++ {newrelic-php => newrelic}/defaults/main.yml | 4 +++ .../files/548C16BF.gpg | 0 .../handlers/main.yml | 5 ++++ {newrelic-sysmond => newrelic}/meta/main.yml | 2 +- newrelic/tasks/main.yml | 9 ++++++ .../tasks/main.yml => newrelic/tasks/php.yml | 3 +- .../main.yml => newrelic/tasks/sources.yml | 18 ++++++------ .../main.yml => newrelic/tasks/sysmond.yml | 2 -- {newrelic-php => newrelic}/tests/test.yml | 2 +- 22 files changed, 47 insertions(+), 161 deletions(-) delete mode 100644 newrelic-php/README.md delete mode 100644 newrelic-php/meta/main.yml delete mode 100644 newrelic-sources/.kitchen.yml delete mode 100644 newrelic-sources/README.md delete mode 100644 newrelic-sources/meta/main.yml delete mode 100644 newrelic-sources/tests/test.yml delete mode 100644 newrelic-sysmond/.kitchen.yml delete mode 100644 newrelic-sysmond/README.md delete mode 100644 newrelic-sysmond/defaults/main.yml delete mode 100644 newrelic-sysmond/handlers/main.yml delete mode 100644 newrelic-sysmond/tests/test.yml rename {newrelic-php => newrelic}/.kitchen.yml (100%) create mode 100644 newrelic/README.md rename {newrelic-php => newrelic}/defaults/main.yml (50%) rename {newrelic-sources => newrelic}/files/548C16BF.gpg (100%) rename {newrelic-sources => newrelic}/handlers/main.yml (67%) rename {newrelic-sysmond => newrelic}/meta/main.yml (88%) create mode 100644 newrelic/tasks/main.yml rename newrelic-php/tasks/main.yml => newrelic/tasks/php.yml (96%) rename newrelic-sources/tasks/main.yml => newrelic/tasks/sources.yml (84%) rename newrelic-sysmond/tasks/main.yml => newrelic/tasks/sysmond.yml (88%) rename {newrelic-php => newrelic}/tests/test.yml (58%) diff --git a/newrelic-php/README.md b/newrelic-php/README.md deleted file mode 100644 index 36903349..00000000 --- a/newrelic-php/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# newrelic-php - -Installation of NewRelic PHP agent. - -## Tasks - -Everything is in the `tasks/main.yml` file. - -A license key and an application name can be provided to pre-configure the agent. - -## Variables - -* `newrelic_license`: license key (default: empty). -* `newrelic_appname`: application name (default: empty). diff --git a/newrelic-php/meta/main.yml b/newrelic-php/meta/main.yml deleted file mode 100644 index 90f90d1b..00000000 --- a/newrelic-php/meta/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -galaxy_info: - author: Evolix - description: Installation of NewRelic PHP agent. - - issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues - - license: GPLv2 - - min_ansible_version: 2.2 - - platforms: - - name: Debian - versions: - - jessie - -dependencies: [] - # List your role dependencies here, one per line. - # Be sure to remove the '[]' above if you add dependencies - # to this list. diff --git a/newrelic-sources/.kitchen.yml b/newrelic-sources/.kitchen.yml deleted file mode 100644 index b21cc3db..00000000 --- a/newrelic-sources/.kitchen.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -driver: - name: docker - privileged: true - use_sudo: false - -provisioner: - name: ansible_playbook - hosts: test-kitchen - roles_path: ../ - ansible_verbose: true - require_ansible_source: false - require_chef_for_busser: false - idempotency_test: true - -platforms: - - name: debian - driver_config: - image: evolix/ansible:2.2.1 - -suites: - - name: default - provisioner: - name: ansible_playbook - playbook: ./tests/test.yml - -transport: - max_ssh_sessions: 6 diff --git a/newrelic-sources/README.md b/newrelic-sources/README.md deleted file mode 100644 index 2b9ddb9d..00000000 --- a/newrelic-sources/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# newrelic-sources - -Installation of NewRelic repository for APT sources. - -## Tasks - -Everything is in the `tasks/main.yml` file. - -NB : the repository key is store in the role and not fetched online, for performance reasons. diff --git a/newrelic-sources/meta/main.yml b/newrelic-sources/meta/main.yml deleted file mode 100644 index 19506b43..00000000 --- a/newrelic-sources/meta/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -galaxy_info: - author: Evolix - description: Installation of NewRelic repository for APT sources. - - issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues - - license: GPLv2 - - min_ansible_version: 2.2 - - platforms: - - name: Debian - versions: - - jessie - -dependencies: [] - # List your role dependencies here, one per line. - # Be sure to remove the '[]' above if you add dependencies - # to this list. diff --git a/newrelic-sources/tests/test.yml b/newrelic-sources/tests/test.yml deleted file mode 100644 index 3813409e..00000000 --- a/newrelic-sources/tests/test.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- hosts: test-kitchen - roles: - - role: newrelic-sources diff --git a/newrelic-sysmond/.kitchen.yml b/newrelic-sysmond/.kitchen.yml deleted file mode 100644 index b21cc3db..00000000 --- a/newrelic-sysmond/.kitchen.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -driver: - name: docker - privileged: true - use_sudo: false - -provisioner: - name: ansible_playbook - hosts: test-kitchen - roles_path: ../ - ansible_verbose: true - require_ansible_source: false - require_chef_for_busser: false - idempotency_test: true - -platforms: - - name: debian - driver_config: - image: evolix/ansible:2.2.1 - -suites: - - name: default - provisioner: - name: ansible_playbook - playbook: ./tests/test.yml - -transport: - max_ssh_sessions: 6 diff --git a/newrelic-sysmond/README.md b/newrelic-sysmond/README.md deleted file mode 100644 index c63e4d05..00000000 --- a/newrelic-sysmond/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# newrelic-sysmond - -Installation of NewRelic sysmond. - -## Tasks - -Everything is in the `tasks/main.yml` file. - -if a license key is provided, the daemon is configured. - -## Variables - -* `newrelic_license`: license key (default: empty). diff --git a/newrelic-sysmond/defaults/main.yml b/newrelic-sysmond/defaults/main.yml deleted file mode 100644 index e2d18908..00000000 --- a/newrelic-sysmond/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -newrelic_license: "" diff --git a/newrelic-sysmond/handlers/main.yml b/newrelic-sysmond/handlers/main.yml deleted file mode 100644 index 5f5a2562..00000000 --- a/newrelic-sysmond/handlers/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: restart newrelic-sysmond - systemd: - name: newrelic-sysmond - state: restarted diff --git a/newrelic-sysmond/tests/test.yml b/newrelic-sysmond/tests/test.yml deleted file mode 100644 index 69165293..00000000 --- a/newrelic-sysmond/tests/test.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- hosts: test-kitchen - roles: - - role: newrelic-sysmond diff --git a/newrelic-php/.kitchen.yml b/newrelic/.kitchen.yml similarity index 100% rename from newrelic-php/.kitchen.yml rename to newrelic/.kitchen.yml diff --git a/newrelic/README.md b/newrelic/README.md new file mode 100644 index 00000000..ee22f3bc --- /dev/null +++ b/newrelic/README.md @@ -0,0 +1,17 @@ +# newrelic-sources + +Installation of NewRelic tools. + +## Tasks + +Everything is in the `tasks/main.yml` file. + +NB : the repository key is store in the role and not fetched online, for performance reasons. + +## Variables + +* `newrelic_license`: license key (default: empty). +* `newrelic_appname`: application name (default: empty). + +* `newrelic_php` : install the php module (default: `False`) +* `newrelic_sysmond` : install the sysmond agent (default: `True`) diff --git a/newrelic-php/defaults/main.yml b/newrelic/defaults/main.yml similarity index 50% rename from newrelic-php/defaults/main.yml rename to newrelic/defaults/main.yml index b568b78e..cddbcb0b 100644 --- a/newrelic-php/defaults/main.yml +++ b/newrelic/defaults/main.yml @@ -1,3 +1,7 @@ --- +newrelic_sysmond: True + +newrelic_php: False + newrelic_license: "" newrelic_appname: "" diff --git a/newrelic-sources/files/548C16BF.gpg b/newrelic/files/548C16BF.gpg similarity index 100% rename from newrelic-sources/files/548C16BF.gpg rename to newrelic/files/548C16BF.gpg diff --git a/newrelic-sources/handlers/main.yml b/newrelic/handlers/main.yml similarity index 67% rename from newrelic-sources/handlers/main.yml rename to newrelic/handlers/main.yml index 3e8e7d5a..4ad78be9 100644 --- a/newrelic-sources/handlers/main.yml +++ b/newrelic/handlers/main.yml @@ -13,3 +13,8 @@ - name: apt update apt: update_cache: yes + +- name: restart newrelic-sysmond + systemd: + name: newrelic-sysmond + state: restarted diff --git a/newrelic-sysmond/meta/main.yml b/newrelic/meta/main.yml similarity index 88% rename from newrelic-sysmond/meta/main.yml rename to newrelic/meta/main.yml index cd47e809..b355644e 100644 --- a/newrelic-sysmond/meta/main.yml +++ b/newrelic/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: author: Evolix - description: Installation of NewRelic sysmond. + description: Installation of NewRelic tools. issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues diff --git a/newrelic/tasks/main.yml b/newrelic/tasks/main.yml new file mode 100644 index 00000000..7537214d --- /dev/null +++ b/newrelic/tasks/main.yml @@ -0,0 +1,9 @@ +--- + +- include: sources.yml + +- include: php.yml + when: newrelic_php + +- include: sysmond.yml + when: newrelic_sysmond diff --git a/newrelic-php/tasks/main.yml b/newrelic/tasks/php.yml similarity index 96% rename from newrelic-php/tasks/main.yml rename to newrelic/tasks/php.yml index c5ce2fe5..712b42f2 100644 --- a/newrelic-php/tasks/main.yml +++ b/newrelic/tasks/php.yml @@ -1,6 +1,4 @@ --- -- include_role: - name: newrelic-sources - name: Pre-seed package configuration with app name debconf: @@ -41,3 +39,4 @@ - name: Install package for PHP apt: name: newrelic-php5 + state: installed diff --git a/newrelic-sources/tasks/main.yml b/newrelic/tasks/sources.yml similarity index 84% rename from newrelic-sources/tasks/main.yml rename to newrelic/tasks/sources.yml index 86b6a1d4..cdcf5dc2 100644 --- a/newrelic-sources/tasks/main.yml +++ b/newrelic/tasks/sources.yml @@ -1,16 +1,10 @@ --- + - name: Add dotdeb GPG key apt_key: # url: https://download.newrelic.com/548C16BF.gpg data: "{{ lookup('file', '548C16BF.gpg') }}" -- name: Find squid config whitelist - shell: find /etc/squid/whitelist-custom.conf /etc/squid3/whitelist-custom.conf /etc/squid/whitelist.conf /etc/squid3/whitelist.conf 2> /dev/null - failed_when: false - changed_when: false - check_mode: no - register: squid_whitelist_files - - name: set squid_service_name=squid3 for Debian < 9 set_fact: squid_service_name: squid3 @@ -18,6 +12,13 @@ - ansible_distribution == "Debian" - ansible_distribution_major_version | version_compare('9', '<') +- name: Find squid config whitelist + shell: find /etc/{{ squid_service_name | default('squid') }}/whitelist-custom.conf /etc/{{ squid_service_name | default('squid') }}/whitelist.conf 2> /dev/null + failed_when: false + changed_when: false + check_mode: no + register: squid_whitelist_files + - name: Append packages.dotdeb.org to Squid whitelist lineinfile: dest: "{{ squid_whitelist_files.stdout_lines | first }}" @@ -33,5 +34,4 @@ repo: "deb http://apt.newrelic.com/debian/ newrelic non-free" state: present filename: newrelic - -- meta: flush_handlers + update_cache: yes diff --git a/newrelic-sysmond/tasks/main.yml b/newrelic/tasks/sysmond.yml similarity index 88% rename from newrelic-sysmond/tasks/main.yml rename to newrelic/tasks/sysmond.yml index a586efbf..5d72a470 100644 --- a/newrelic-sysmond/tasks/main.yml +++ b/newrelic/tasks/sysmond.yml @@ -1,6 +1,4 @@ --- -- include_role: - name: newrelic-sources - name: Install system monitor daemon apt: diff --git a/newrelic-php/tests/test.yml b/newrelic/tests/test.yml similarity index 58% rename from newrelic-php/tests/test.yml rename to newrelic/tests/test.yml index c85b0f1c..3a6d806e 100644 --- a/newrelic-php/tests/test.yml +++ b/newrelic/tests/test.yml @@ -1,4 +1,4 @@ --- - hosts: test-kitchen roles: - - role: newrelic-php + - role: newrelic