Bug #38238
openSuccess shown for remote execution of ansible playbook though timeout to kill was exceeded
Description
When a ansible playbook is executed as remote job on several hosts, there is the possibility to set a "timeout to kill". If the playbook hangs on one of the hosts and the timeout is reached, the execution on all hosts is terminated. However, the status that is show in the Foreman UI is ✅success for all of the hosts, see also the attached screenshot for an overview of the problem. Tested with foreman 3.13.0
I think this is a regression: according to the code and discussion in the PR where this feature was introduced (https://github.com/theforeman/smart_proxy_ansible/pull/41), this should show up as unsuccessful execution in some way or another.
To me as a user it is not clear what the expected behavior is when the playbook runs into a timeout on only some hosts. If this turns out to be the intended behavior, it should be documented somewhere, otherwise users will assume their playbook was executed successfully on all hosts even when it was not.
Steps to Reproduce:
1. Select 2 (or more) hosts on the all hosts page and click on Action -> Schedule Remote Job
2. Select Job Category: Ansible Playbook and Job template: Ansible - Run playbook, click next
3. As playbook, paste the playbook that I attached below (adapt the string 'pattern' in line 14 to one of the selected host's host name) and click next
4. In advanced fields, set the "timeout to kill" to 30 (seconds) and click "run on selected hosts"
The playbook has a task that delays for 10 minutes only on the hosts whose hostname matches the pattern set in step 3, so while the other tasks on the other hosts run through, this one host hangs and triggers the "timeout to kill".
Actual results:
the job gets terminated after the timeout, and shows that the job was executed on all hosts successfully
Expected results:
at least on the host where `pattern` is in the hostname and that therefore waits 10 minutes in an ansible task, the status should be "failed" and not successful
Files
No data to display