ansible-datadog icon indicating copy to clipboard operation
ansible-datadog copied to clipboard

Hard fail if api_key is not provided

Open gopivalleru opened this issue 1 year ago • 2 comments

datadog.conf and datadog.yaml role has below line which sets a invalid default value for api_key. If agent_datadog_config["api_key"] or datadog_api_key vars are not provided then api_key in the datadog has 'youshouldsetthis' which fails to start datadog agent. Setting default here actual installs datadog but fails to start the agent until user notices.

{% if agent_datadog_config["api_key"] is not defined -%}
api_key: {{ datadog_api_key | default('youshouldsetthis') }}
{% endif %}

Its better to hard fail while the role is being executed so that the user will provide necessary mandator variables.

gopivalleru avatar Jul 18 '23 16:07 gopivalleru

Created PR: https://github.com/DataDog/ansible-datadog/pull/505

gopivalleru avatar Jul 18 '23 18:07 gopivalleru

For many users this is a breaking change, see https://github.com/DataDog/ansible-datadog/pull/505#issuecomment-1871306366

anth0d avatar Jan 02 '24 17:01 anth0d

Fixed by #505.

alopezz avatar Jul 19 '24 14:07 alopezz