newrelic / ansible-install

Building installation support for our customers are using ansible to manage their infrastructure and services at scale
Apache License 2.0
7 stars 7 forks source link

Improve error message when target is not defined #63

Open Julien4218 opened 1 year ago

Julien4218 commented 1 year ago

When providing a list of target, if one of the value is incorrect, it would be great to get back a user message with all the possible values to use, source https://github.com/newrelic/ansible-install/blob/main/defaults/main.yml$L4

Desired Behavior

Instead of

TASK [newrelic.newrelic_install : Validate targets] *******************************************************************************************************************
failed: [1.2.3.4] (item=infa) => {"ansible_loop_var": "item", "assertion": "target_name_map[item] is defined", "changed": false, "evaluated_to": false, "item": "infa", "msg": "Assertion failed"}

It should say something like

TASK [newrelic.newrelic_install : Assert target values are defined] *******************************************************************************
failed: [1.2.3.4] => {
    "changed": false,
    "msg": "undefined target value of infa. target should be one of: infrastructure, logs, apm..."
}