From 8db7a6a88cf40435bb78e54a22dabe8d4fd23b47 Mon Sep 17 00:00:00 2001 From: danielsimkus Date: Thu, 30 Jan 2020 09:04:05 +0000 Subject: [PATCH 1/2] Only try stop sysprobe if it is installed --- tasks/agent-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/agent-linux.yml b/tasks/agent-linux.yml index 5d397a65..47e2db1d 100644 --- a/tasks/agent-linux.yml +++ b/tasks/agent-linux.yml @@ -94,7 +94,7 @@ name: datadog-agent-sysprobe state: stopped enabled: no - when: not datadog_skip_running_check and (not datadog_enabled or not datadog_sysprobe_enabled) + when: not datadog_skip_running_check and (not datadog_enabled or not datadog_sysprobe_enabled) and ansible_facts.services['datadog-agent-sysprobe'] is defined - name: Ensure datadog-agent, datadog-agent-process and datadog-agent-trace are not running service: From 5299d1ae4bf2af14474d83d4d19ab33a1e613df9 Mon Sep 17 00:00:00 2001 From: danielsimkus Date: Fri, 31 Jan 2020 08:24:44 +0000 Subject: [PATCH 2/2] Set both sysprob service checks into a datadog_sysprove_installed fact --- tasks/agent-linux.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasks/agent-linux.yml b/tasks/agent-linux.yml index 47e2db1d..7167005b 100644 --- a/tasks/agent-linux.yml +++ b/tasks/agent-linux.yml @@ -76,11 +76,15 @@ enabled: yes when: not datadog_skip_running_check and datadog_enabled and not ansible_check_mode +- name: set system probe installed + set_fact: + datadog_sysprobe_installed: "{{ ansible_facts.services['datadog-agent-sysprobe'] is defined or ansible_facts.services['datadog-agent-sysprobe.service'] is defined }}" + - name: set system probe enabled set_fact: datadog_sysprobe_enabled: "{{ system_probe_config is defined and system_probe_config['enabled'] - and (ansible_facts.services['datadog-agent-sysprobe'] is defined or ansible_facts.services['datadog-agent-sysprobe.service'] is defined) }}" + and datadog_sysprobe_installed }}" - name: Ensure datadog-agent-sysprobe is running if enabled and installed service: @@ -94,7 +98,7 @@ name: datadog-agent-sysprobe state: stopped enabled: no - when: not datadog_skip_running_check and (not datadog_enabled or not datadog_sysprobe_enabled) and ansible_facts.services['datadog-agent-sysprobe'] is defined + when: not datadog_skip_running_check and (not datadog_enabled or not datadog_sysprobe_enabled) and datadog_sysprobe_installed - name: Ensure datadog-agent, datadog-agent-process and datadog-agent-trace are not running service: