ansible icon indicating copy to clipboard operation
ansible copied to clipboard

Better config prometheus output

Open tibz7 opened this issue 2 years ago • 2 comments

When running the task Configure prometheus, the task might fail if there is a validation error.... but that error is just hidden to the user running the playbook! So the only hack i ve found was changing the value to true in the task.... Which not the way to go. I also tried to export env=CI in my env but without luck.

Also it is quite anoying that when running ansible with the check_mode everything looks good, but while running it for real it fails! Would it be possible to run promtool check against a temporary file or something like that, so it fails and report the error in check mode?

tibz7 avatar Dec 01 '23 11:12 tibz7

This is a tricky one, the output is hidden as it might contain sensitive data, and ansible does not write the file anywhere if it fails the validation.

What you could do is to enable the ansible debugger in your playbook, it should allow you to investigate the issue. https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_debugger.html

gardar avatar Oct 18 '24 17:10 gardar

As a workaround, you can set CI=1 in your environment. (Any other value will do as well.) This has the effect of setting no_log: false on the task, here:

https://github.com/prometheus-community/ansible/blob/5df0df65921a60bfb45c503a98627b6f87f1f11c/roles/prometheus/tasks/configure.yml#L116

ttencate avatar Dec 20 '24 15:12 ttencate