Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Role Fails When Running Initially in Check Mode #72

Closed
seancallaway opened this issue Sep 28, 2020 · 0 comments · Fixed by #73
Closed

Role Fails When Running Initially in Check Mode #72

seancallaway opened this issue Sep 28, 2020 · 0 comments · Fixed by #73
Labels
bug Something isn't working

Comments

@seancallaway
Copy link
Contributor

What happened?

When including this role in a playbook running in check mode without the role having run against this host before, the step "Ensure blackbox exporter binary has cap_net_raw capability" fails, as /usr/local/bin/blackbox_exporter does not yet exist.

fatal: [hostname.mydomain.com]: FAILED! => {"changed": false, "msg": "Unable to get capabilities of /usr/local/bin/blackbox_exporter", "stderr": "/usr/local/bin/blackbox_exporter (No such file or directory)\n", "stderr_lines": ["/usr/local/bin/blackbox_exporter (No such file or directory)"], "stdout": "", "stdout_lines": []}

Did you expect to see some different?

I would expect to be able to get through a check mode without this role causing to to fail. I think a skipped and possibly a debug message indicating that this step isn't checked due to the possibility of failure would be acceptable.

How to reproduce it (as minimally and precisely as possible):

Targeting a host against which this role has not been applied, include this role in a playbook and run ansible-playbook in check mode (--check).

Environment

  • Role version:

    0.9.2

  • Ansible version information:

    Collecting ansible==2.9.9

  • Variables:

N/A

  • Ansible playbook execution Logs:
TASK [cloudalchemy.blackbox-exporter : Ensure blackbox exporter binary has cap_net_raw capability] ***
fatal: [hostname.mydomain.com]: FAILED! => {"changed": false, "msg": "Unable to get capabilities of /usr/local/bin/blackbox_exporter", "stderr": "/usr/local/bin/blackbox_exporter (No such file or directory)\n", "stderr_lines": ["/usr/local/bin/blackbox_exporter (No such file or directory)"], "stdout": "", "stdout_lines": []}

Anything else we need to know?:

I think that including when: not ansible_check_mode on this tasks (along with a warning message when: ansible_check_mode) would be a good fix for this. I will submit a PR to fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant