Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1931489 - Timeout to kill settings in job execution is not honored when running an Ansible playbook
Summary: Timeout to kill settings in job execution is not honored when running an Ansi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.8.0
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Sam Bible
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-22 14:31 UTC by Teoman ONAY
Modified: 2022-07-05 14:29 UTC (History)
5 users (show)

Fixed In Version: tfm-rubygem-smart_proxy_ansible-3.3.0,
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:28:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32203 0 Normal Closed Set Timeout to kill settings for ansible runner process explicitly 2021-07-28 17:36:01 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:29:24 UTC

Description Teoman ONAY 2021-02-22 14:31:54 UTC
Description of problem:
When executing an Ansible playbook via Satellite job scheduler, the "Timeout to kill" setting is not honored.

I did a test using the "pause" module to make playbook last for 5 min:

---
- hosts: all
  tasks:
    - name: Pause for 5 minutes
      pause:
        minutes: 5

and by setting the "timeout to kill" to 30 seconds, it should have terminated the job after 30 sec but it ran for the planned 5 min.

Doing the same with a remote command (to execute a shell script hosted on the target) is killed as expected

1: Timeout for execution passed, trying to stop the job
2: Exit status: TERM

Version-Release number of selected component (if applicable):
6.8.3 (6.6 as well)

How reproducible:

Create a playbook which last quite some time and set a "Timeout to kill" shorter

Steps to Reproduce:
1.
2.
3.

Actual results:
- Ansible playbook continues to run after the "Timeout to kill" period.


Expected results:
- Ansible playbook should be killed after the "Timeout to kill" period.


Additional info:

Comment 1 Adam Ruzicka 2021-02-22 14:47:46 UTC
Could you attach output from that job to this bz?

Comment 2 Teoman ONAY 2021-02-22 15:46:28 UTC
Is this what you need? 

Job 204 - Ansible playbook with a timeout of 30 sec
Job 203 - remote command with a timeout of 30 sec

[root@satellite ~]# hammer job-invocation info --id=204
ID:                  204
Description:         Ansible - Run playbook with inputs playbook="---
- hosts: all
  tasks:
    - name: Pause for 2 minutes
      pause:
        minutes: 2
"
Status:              succeeded
Success:             1
Failed:              0
Pending:             0
Total:               1
Start:               2021-02-22 13:59:45 UTC
Randomized ordering: false
Job Category:        Ansible Playbook
Hosts:               
 - oscar-ducote.lab-internal.localdomain

[root@satellite ~]# hammer job-invocation info --id=203
ID:                  203
Description:         Run /root/wait.sh
Status:              failed
Success:             0
Failed:              1
Pending:             0
Total:               1
Start:               2021-02-22 13:03:45 UTC
Randomized ordering: false
Job Category:        Commands
Hosts:               
 - oscar-ducote.lab-internal.localdomain


[root@satellite ~]# hammer job-invocation output --host "oscar-ducote.lab-internal.localdomain" --id=204

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************

ok: [tonay-oscar-ducote.lab-internal.localdomain]

TASK [Pause for 2 minutes] **********************************

Pausing for 120 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [oscar-ducote.lab-internal.localdomain]
PLAY RECAP *********************************************************************
tonay-oscar-ducote.lab-internal.localdomain : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
Exit status: 0

[root@satellite ~]# hammer job-invocation output --host "oscar-ducote.lab-internal.localdomain" --id=203
Timeout for execution passed, trying to stop the job
Exit status: TERM

Comment 6 Shira Maximov 2021-03-25 10:06:43 UTC
Created redmine issue https://projects.theforeman.org/issues/32203 from this bug

Comment 8 Bryan Kearney 2021-06-22 16:01:40 UTC
Upstream bug assigned to ymakias

Comment 9 Bryan Kearney 2021-06-22 16:01:50 UTC
Upstream bug assigned to ymakias

Comment 10 Bryan Kearney 2021-07-14 12:01:38 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32203 has been resolved.

Comment 12 Sam Bible 2022-04-25 17:41:28 UTC
Verified on 6.11 - 16

Steps to verify:
1) Create a Job Template that runs this Ansible Playbook:

---
- hosts: all
  tasks:
    - name: Pause for 2 minutes
      pause:
        minutes: 2

2)Set timeout for the Job to 30 seconds.
3)Execute job on Host

Expected Results:
Job is terminated after 30 seconds, respecting the timeout settings

Actual Results: 
Job is terminated after 30 seconds, respecting the timeout settings

Comment 15 errata-xmlrpc 2022-07-05 14:28:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.