Bug 2167532

Summary: Satellite running Ansible Jobs and setting the wrong status about the execution
Product: Red Hat Satellite Reporter: Aldrey Souza <alsouza>
Component: Remote ExecutionAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Peter Ondrejka <pondrejk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.12.1CC: aruzicka
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-07 08:14:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aldrey Souza 2023-02-06 23:27:14 UTC
Description of problem:
 When you are running the Ansible Commands, it's creating the jobs but if anyone failed, then it will show '100% Failed'.

Version-Release number of selected component (if applicable):
6.12.1

How reproducible:
 Create an Ansible Job with any server without communication or ssh key failure.

Steps to Reproduce:
 1. Satellite WebUI
 2. Monitor
 3. Jobs
 4. Run Job
 5. Fill the Job information with two or more servers (host_collection or another way):
   Job category *: Ansible Commands
   Job template *: Run Command - Ansible Default
   Search Query: host_collection=hc_test
   Resolves to: 2 hosts
   command *: id


Actual results:
 Results: 100% Failed

Expected results:
 Results: 50% Success - 50% Failed

Additional info:

- First test: 
 Job category *: Ansible Commands
 Job template *: Run Command - Ansible Default
 Search Query: host_collection=hc_test
 Resolves to: 2 hosts
 command *: id

 Results: 100% Failed

 Individual Result: 
  ~~~ host 01 ~~~
  35: PLAY RECAP *********************************************************************
  36: host01.example.com : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
  37: Exit status: 4
  ~~~ end 01 ~~~

  ~~~ host 02 ~~~
  16: PLAY RECAP *********************************************************************
  17: host02.example.com : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
  18: Exit status: 4
  ~~~ end 02 ~~~


- Second test:

 Job category *: Commands
 Job template *: Run Command - Script Default
 Search Query: host_collection=hc_test
 Resolves to: 2 hosts
 command *: id

 Results: 50% Success - 50% Failed

 Individual Result: 
  ~~~ host 01 ~~~
  1: uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
  2: Exit status: 0
  ~~~ end 01 ~~~

  ~~~ host 02 ~~~
  1: Error initializing command: RuntimeError - Failed to establish connection to remote host, exit code: 255
  2: Exit status: EXCEPTION
  ~~~ end 02 ~~~

Comment 2 Adam Ruzicka 2023-02-07 08:14:52 UTC
Most likely a duplicate of BZ #2167396. I'll go ahead and close this one, if you feel this is actually not a duplicate, feel free to reopen.

*** This bug has been marked as a duplicate of bug 2167396 ***