Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report ansible-playbook failure more verbosely #28

Open
comps opened this issue Jun 26, 2023 · 0 comments
Open

Report ansible-playbook failure more verbosely #28

comps opened this issue Jun 26, 2023 · 0 comments

Comments

@comps
Copy link
Contributor

comps commented Jun 26, 2023

Currently, if ansible-playbook fails, the only reported result is simply

ERROR / (CalledProcessError: Command '['ansible-playbook', '-v', '-i', '192.168.121.21,', '--private-key', '/var/lib/libvirt/images/contest.sshkey', PosixPath('/usr/share/scap-security-guide/ansible/rhel9-playbook-stig_gui.yml')]' returned non-zero exit status 2.)

however we could be more verbose by parsing the output line-by-line (while printing it on stdout) and watching for something like ^fatal (instead of ^ok), so we can catch and re-report this:

fatal: [192.168.121.21]: FAILED! => {"changed": true, "cmd": ["usbguard", "generate-policy"], "delta": "0:00:00.001775", "end": "2023-06-26 15:15:50.050348", "msg": "non-zero return code", "rc": 127, "start": "2023-06-26 15:15:50.048573", "stderr": "usbguard: error while loading shared libraries: libusbguard.so.1: cannot open shared object file: Operation not permitted", "stderr_lines": ["usbguard: error while loading shared libraries: libusbguard.so.1: cannot open shared object file: Operation not permitted"], "stdout": "", "stdout_lines": []}

perhaps as a Note (?).

It wouldn't be waive-able, because this is the initial remediation (and not a scan), but at least it would give us more details upfront without having to dive into the fulltext log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant