From f49d47b1e749e93db495b956182946aae8725092 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 13 Aug 2020 18:06:46 +0200 Subject: [PATCH 1/5] Added support for 3rd party integrations --- README.md | 10 ++++++++++ tasks/integration.yml | 9 ++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 579f56bd..530c4832 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,16 @@ Available actions: version: ``` +To install third party integrations, set `third_party` to true: + +```yml + datadog_integration: + : + action: + version: + third_party: true +``` + ##### Example This example installs version `1.11.0` of the ElasticSearch integration and removes the `postgres` integration. diff --git a/tasks/integration.yml b/tasks/integration.yml index d46ee6bb..77ba856e 100644 --- a/tasks/integration.yml +++ b/tasks/integration.yml @@ -49,19 +49,14 @@ # Install integrations - name: Install pinned version of integrations (Unix) - command: - argv: - - "{{ datadog_agent_binary_path }}" - - integration - - install - - "{{ item.key }}=={{ item.value.version }}" + command: "{{ datadog_agent_binary_path }} integration install {% if 'third_party' in item.value and item.value.third_party %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" become: yes become_user: "{{ integration_command_user }}" loop: "{{ datadog_integration|dict2items }}" when: item.value.action == "install" and ansible_os_family != "Windows" - name: Install pinned version of integrations (Windows) - win_command: "\"{{ datadog_agent_binary_path }}\" integration install {{ item.key }}=={{ item.value.version }}" + win_command: "\"{{ datadog_agent_binary_path }}\" integration install {% if 'third_party' in item.value and item.value.third_party %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" become: yes become_user: "{{ integration_command_user }}" loop: "{{ datadog_integration|dict2items }}" From 71f96e5635900341af07da56281e4b6c29cd077d Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 13 Aug 2020 18:07:08 +0200 Subject: [PATCH 2/5] Update path to key in manual tests --- manual_tests/inventory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual_tests/inventory b/manual_tests/inventory index 41c7a7dd..ce6468b7 100644 --- a/manual_tests/inventory +++ b/manual_tests/inventory @@ -1,2 +1,2 @@ [test_host] -127.0.0.1 ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2200 ansible_ssh_private_key_file=./ansible-datadog/tests/.vagrant/machines/default/virtualbox/private_key +127.0.0.1 ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2222 ansible_ssh_private_key_file=./ansible-datadog/manual_tests/.vagrant/machines/default/virtualbox/private_key From d06a8f1ebbf547811a2bcd633e265a4bb6c8477e Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 13 Aug 2020 18:08:18 +0200 Subject: [PATCH 3/5] Added test --- manual_tests/test_7_full.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manual_tests/test_7_full.yml b/manual_tests/test_7_full.yml index 2f275ce4..32c4899b 100644 --- a/manual_tests/test_7_full.yml +++ b/manual_tests/test_7_full.yml @@ -25,6 +25,11 @@ env: dev trace.concentrator: extra_aggregators: version + datadog_integration: + datadog-aqua: + action: 'install' + version: '1.0.0' + third_party: true datadog_checks: process: init_config: From 0d325b20ae2862325f8380820ab5c0462cc25390 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 13 Aug 2020 18:31:03 +0200 Subject: [PATCH 4/5] Make check for true explicit --- tasks/integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/integration.yml b/tasks/integration.yml index 77ba856e..2375a41c 100644 --- a/tasks/integration.yml +++ b/tasks/integration.yml @@ -49,14 +49,14 @@ # Install integrations - name: Install pinned version of integrations (Unix) - command: "{{ datadog_agent_binary_path }} integration install {% if 'third_party' in item.value and item.value.third_party %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" + command: "{{ datadog_agent_binary_path }} integration install {% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" become: yes become_user: "{{ integration_command_user }}" loop: "{{ datadog_integration|dict2items }}" when: item.value.action == "install" and ansible_os_family != "Windows" - name: Install pinned version of integrations (Windows) - win_command: "\"{{ datadog_agent_binary_path }}\" integration install {% if 'third_party' in item.value and item.value.third_party %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" + win_command: "\"{{ datadog_agent_binary_path }}\" integration install {% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" become: yes become_user: "{{ integration_command_user }}" loop: "{{ datadog_integration|dict2items }}" From 9e10bc606ec45db24d86f35aecebc2f94e4a1ec8 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 14 Aug 2020 13:20:31 +0200 Subject: [PATCH 5/5] Use `vars` --- tasks/integration.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasks/integration.yml b/tasks/integration.yml index 2375a41c..55a55e7a 100644 --- a/tasks/integration.yml +++ b/tasks/integration.yml @@ -49,15 +49,19 @@ # Install integrations - name: Install pinned version of integrations (Unix) - command: "{{ datadog_agent_binary_path }} integration install {% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" + command: "{{ datadog_agent_binary_path }} integration install {{ third_party }} {{ item.key }}=={{ item.value.version }}" become: yes become_user: "{{ integration_command_user }}" + vars: + third_party: "{% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %}" loop: "{{ datadog_integration|dict2items }}" when: item.value.action == "install" and ansible_os_family != "Windows" - name: Install pinned version of integrations (Windows) - win_command: "\"{{ datadog_agent_binary_path }}\" integration install {% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %} {{ item.key }}=={{ item.value.version }}" + win_command: "\"{{ datadog_agent_binary_path }}\" integration install {{ third_party }} {{ item.key }}=={{ item.value.version }}" become: yes + vars: + third_party: "{% if 'third_party' in item.value and item.value.third_party == true %}--third-party{% endif %}" become_user: "{{ integration_command_user }}" loop: "{{ datadog_integration|dict2items }}" when: item.value.action == "install" and ansible_os_family == "Windows"