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 any ansible-playbook fatal errors #136

Merged
merged 1 commit into from
Apr 3, 2024
Merged

report any ansible-playbook fatal errors #136

merged 1 commit into from
Apr 3, 2024

Conversation

comps
Copy link
Contributor

@comps comps commented Apr 3, 2024

This was inspired by

TASK [Set 'dns' to 'none' in the [main] section of '/etc/NetworkManager/NetworkManager.conf'] ***
fatal: [192.168.121.90]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ini_file) module: ignore_spaces. Supported parameters include: allow_no_value, attributes, backup, create, exclusive, group, mode, no_extra_spaces, option, owner, path, section, selevel, serole, setype, seuser, state, unsafe_writes, value, values (attr, dest)."}

PLAY RECAP *********************************************************************
192.168.121.90             : ok=2552 changed=419  unreachable=0    failed=1    skipped=983  rescued=0    ignored=1   

where the overall reported result was just

subprocess.CalledProcessError: Command '['ansible-playbook', '-v', '-i', '192.168.121.90,', '--private-key', '/var/lib/libvirt/images/contest.sshkey', '--skip-tags', 'accounts_password_set_max_life_existing,accounts_password_set_max_life_root', PosixPath('/usr/share/scap-security-guide/ansible/rhel9-playbook-stig.yml')]' returned non-zero exit status 2.

which is somewhat confusing (with the --skip-tags and all).

With this change, the fatal error gets reported and the overall ansible-playbook exit code 2 is ignored, allowing us to waive the one reported error instead of waiving both the fatal: error + CalledProcessError caused error.

errr /hardening/ansible/stig/playbook: Enable FIPS Mode - Check to See the Current Status of FIPS Mode (on default-0) ({"changed": false, "cmd": ["/usr/bin/fips-mode-setup", "--check"], "delta": "0:00:00.367348", "end": "2024-04-02 18:57:21.135536", "msg": "non-zero return code", "rc": 1, "start": "2024-04-02 18:57:20.768188", "stderr": "", "stderr_lines": [], "stdout": "FIPS mode is disabled. Inconsistent state detected.", "stdout_lines": ["FIPS mode is disabled.", "Inconsistent state detected."]}) [1/1]

The waiver actually won't be necessary if we wait with this PR until ComplianceAsCode/content#11782 is merged.

Signed-off-by: Jiri Jaburek <comps@nomail.dom>
@mildas mildas merged commit 6b44d42 into main Apr 3, 2024
@mildas mildas deleted the ansible_errors branch April 3, 2024 12:51
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

Successfully merging this pull request may close these issues.

2 participants