Project

General

Profile

Actions

Bug #38238

open

Success shown for remote execution of ansible playbook though timeout to kill was exceeded

Added by Martin Spiessl 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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

ansible_playbook_timeout.png View ansible_playbook_timeout.png 286 KB Screenshot illustrating the problem Martin Spiessl, 02/24/2025 02:50 PM
playbook.yaml playbook.yaml 663 Bytes Playbook that can be used to reproduce the issue Martin Spiessl, 02/24/2025 02:52 PM

No data to display

Actions

Also available in: Atom PDF