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 2107577 - execution of roles with missing modules doesn't fail the execution
Summary: execution of roles with missing modules doesn't fail the execution
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.12.0
Assignee: Adam Ruzicka
QA Contact: Sam Bible
URL:
Whiteboard:
: 2118459 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-15 12:50 UTC by Evgeni Golov
Modified: 2024-08-21 09:54 UTC (History)
9 users (show)

Fixed In Version: tfm-rubygem-smart_proxy_ansible-3.4.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-16 13:34:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35049 0 Normal New Ansible run failing with syntax error, e.g. the module is not found (missing collection) it still returns 0 exit code 2022-07-15 13:10:20 UTC
Red Hat Issue Tracker SAT-11683 0 None None None 2022-08-16 19:51:33 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:34:54 UTC

Description Evgeni Golov 2022-07-15 12:50:35 UTC
Description of problem:
Ohai,

given the following dummy role:
# cat /etc/ansible/roles/evgeni.test/tasks/main.yml
---
- name: this will fail
  nonexisting_module:

And assigning this role to a host, the resulting job invocation will not fail!

  89: TASK [Apply roles] *************************************************************
  90: ERROR! couldn't resolve module/action 'nonexisting_module'. This often indicates a misspelling, missing collection, or incorrect module path.
  91:
  92: The error appears to be in '/etc/ansible/roles/evgeni.test/tasks/main.yml': line 2, column 3, but may
  93: be elsewhere in the file depending on the exact syntax problem.
  94:
  95: The offending line appears to be:
  96:
  97: ---
  98: - name: this will fail
  99:   ^ here
 100: PLAY RECAP *********************************************************************
 101: centos8-stream-katello-4-5.tanso.example.com : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
 102: Exit status: 0

I think the problem is that there is actually no failed task reported from Ansible and we don't analyze the exit code of ansible-runner (which is 2 in this case).

Version-Release number of selected component (if applicable):
Satellite 6.11 GA
Also upstream Foreman 3.3/Katello 4.5

rubygem-smart_proxy_ansible-3.3.1-2.el8sat.noarch
rubygem-foreman_ansible-7.0.4.1-1.el8sat.noarch

rubygem-smart_proxy_ansible-3.4.0-1.fm3_3.el8.noarch
rubygem-foreman_ansible-7.1.0-3.fm3_3.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1. create a role like above
2. assign it to a host
3. run

Actual results:
Job is marked as success in Satellite

Expected results:
Job is marked as failed

Additional info:

Comment 2 Bryan Kearney 2022-07-18 16:05:07 UTC
Upstream bug assigned to aruzicka

Comment 3 Bryan Kearney 2022-07-18 16:05:08 UTC
Upstream bug assigned to aruzicka

Comment 4 Ron Lavi 2022-07-27 06:24:48 UTC
Upstream PR got merged, moving to POST

Comment 5 Sam Bible 2022-08-16 19:46:20 UTC
Verified on 6.12.0 - 6.1

Steps to reproduce:
1. Create an ansible playbook as provided above by Evgeni
2. Assign it to a host, and run it

Expected results: The playbook errors, and the job also fails

Actual results: The playbook errors, and the Job is listed as a success

Additional Info:
I essentially got the same error as Evgeni did, listed below.

TASK [Apply roles] *************************************************************
ERROR! couldn't resolve module/action 'nonexisting_module'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/etc/ansible/roles/testy-2107577/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

 ---
 - name: this will fail
   ^ here
PLAY RECAP *********************************************************************
dhcp-3-58.vms.sat.rdu2.redhat.com : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
Exit status: 0

rubygem-smart_proxy_ansible.noarch                    3.4.0-1.el8sat
rubygem-foreman_ansible.noarch                        7.1.2-1.el8sat

Comment 6 Evgeni Golov 2022-08-17 07:06:07 UTC
I don't think smart_proxy_ansible 3.4.0 contains the fix for that?

cc @aruzicka

Comment 7 Adam Ruzicka 2022-08-17 07:58:55 UTC
It indeed does not. Afaik the fix was not released yet. cc @lstejskal

Comment 8 Joniel Pasqualetto 2022-08-17 15:09:57 UTC
*** Bug 2118459 has been marked as a duplicate of this bug. ***

Comment 10 Sam Bible 2022-09-12 15:18:19 UTC
Verified on 6.12.0 - 6.1

Steps to reproduce:
1. Create an ansible playbook as provided above by Evgeni
2. Assign it to a host, and run it

Expected results: The playbook errors, and the job also fails

Actual results: The playbook errors, and the Job fails as well.

Comment 11 Sam Bible 2022-09-12 15:19:09 UTC
Edit: Verified on 6.12.0 - 10

Comment 15 errata-xmlrpc 2022-11-16 13:34:39 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 (Important: Satellite 6.12 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:8506


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