Replies: 1 comment
-
It is expected in Ansible to terminate a Playbook if any task on it fails. It usually means the Playbook is not robust enough to treat all cases it is exposed to. If this is happening, the correct approach is to investigate the failure, the reason and propose a PR updating the tasks to fix the behavior. A Playbook should execute completely without any unexpected failure (expected failures can be treated in the Playbook itself if necessary). Tasks errors should never be ignored. They usually show opportunities for improvements.
It is not be expected to use the Ansible remediation in this painful this way. We should fix the errors instead.
Yes. We always do that during the review of each PR. In some cases, testing a rule alone shows all green but testing it in a profile context, including many rules, some issues can be revealed. So, in our CI tests we also test different profiles for all PRs. You can also do that locally via
This is the common way to execute it. A good Playbook should finish properly without unexpected failures.
I don't. This would break the logic of many tasks and would make Playbooks totally useless.
We already have this in our CI tests, but not for all profiles and distros. You can take a look in the
|
Beta Was this translation helpful? Give feedback.
-
Hello @marcusburghardt
We (at SUSE) found that it is not possible to remediate a test system by executing the command
ansible-playbook -i "localhost", -c local /usr/share/scap-security-guide/ansible/sle15-playbook-stig.yml
where sle15-playbook-stig.yml is from the last official release, or previous one(s)
The main reason for that is the fact that whenever a task/rule in ansible fails, ansible terminates the play (the bash remediation does not work in this way). We found, for example, that the rules package_pam_apparmor_installed and dir_system_commands_root_owned terminate the execution of the whole ansible playbook. Maybe there are other rules for other vendors.
Because of that ansible playbook has to be executed in portions - rule by rule, or artificially a loop to be created which executes 2 or 3 rules per step. This way of execution makes remediation process very long - for example ~2.5/3 hours.
I have a concern about execution of ansible remediation in a places when we have to remediate many hosts for example in a data center, because this will be a time consuming task.
I have the following questions:
Rumen
Beta Was this translation helpful? Give feedback.
All reactions