diff --git a/salt/datadog/init.sls b/salt/datadog/init.sls index 41d7d691..82ccc567 100644 --- a/salt/datadog/init.sls +++ b/salt/datadog/init.sls @@ -31,12 +31,25 @@ datadog_repo: - source: salt://datadog/files {% if 'datadog_api_key' in pillar %} +check_datadog_installation: + cmd.run: + - name: | + if ! dpkg-query -W datadog-agent || ! test -f /etc/datadog-agent/datadog.yaml; then + dpkg --remove --force-remove-reinstreq datadog-agent || true + apt-get -y --fix-broken install + apt-get update + fi + - hide_output: True + datadog-agent: pkg: - installed - require: - pkgrepo: datadog_repo - - mount: {% if swap_path %}{{ swap_path }}{% endif %} + {% if swap_path %} + - mount: {{ swap_path }} + {% endif %} + - cmd: check_datadog_installation service: - running - enable: True