Bug 1992570 - Only Ansible config jobs should run in check mode
Summary: Only Ansible config jobs should run in check mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Sam Bible
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-11 10:41 UTC by Ondřej Pražák
Modified: 2022-07-05 14:29 UTC (History)
3 users (show)

Fixed In Version: tfm-rubygem-foreman_ansible-6.3.4, tfm-rubygem-foreman_ansible_core-4.2.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:29:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33218 0 None None None 2021-08-11 10:42:43 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:29:49 UTC

Description Ondřej Pražák 2021-08-11 10:41:45 UTC
Description of problem:
When a check mode is enabled for a host, all Ansible based jobs are a dry-run and no changes are made to the target host. Check mode should apply only for running Ansible roles on host. 


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

How reproducible:


Steps to Reproduce:
1. Edit a host, add 'ansible_roles_check_mode = true' as a boolean host parameter and submit
2. From a host detail page, choose 'Run Ansible roles' from the dropdown, wait for job to finish, note there were no changes made on host as expected (this step assumes host has Ansible roles already assigned) 
3. Go to Monitor -> Jobs, Run Job
4. Choose 'Ansible Packages' as job category, 'Package Action - Ansible default' template and try to install a package on the host which has check mode set to 'true' in step 1

Actual results:
Package in step 4 will not be installed

Expected results:
Package action in step 4 should install package

Additional info:

Comment 1 Ondřej Pražák 2021-08-11 10:42:42 UTC
Connecting redmine issue https://projects.theforeman.org/issues/33218 from this bug

Comment 2 Bryan Kearney 2021-08-19 12:05:39 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33218 has been resolved.

Comment 4 Danny Synk 2021-09-28 18:44:34 UTC
Failed QA on Satellite 6.10, snap 20 (tfm-rubygem-foreman_ansible-6.3.4-1.el7sat.noarch, tfm-rubygem-smart_proxy_ansible-3.1.1-1.el7sat.noarch).

Steps to Test:
1. Register a RHEL 7 host to Satellite 6.10 and assign an Ansible role.
2. In the Satellite webUI, navigate to Hosts > All Hosts > [hostname] > Edit > Parameters tab.
3. In the "Global Parameters" section, click the "Override" button in the "Actions" column for the "ansible_roles_check_mode" parameter.
4. In the "Host Parameters" section, change the value of the "Value" field from "false" to "true" for the "ansible_roles_check_mode" parameter.
5. Select the "Run Ansible roles" option.
6. When the job completes, navigate back to Hosts > All Hosts > [hostname] and select the "Schedule Remote Job" option.
7. Select the "Ansible Packages" job category and the "Package Action - Ansible Default" job template, set the state to "present," enter a package that is not currently installed on the host in the "name" field, then click the "Submit" button.

Expected Results:
No changes are made when the Ansible role is run on the host, but the Ansible Packages job successfully installs the package.

Actual Results:
No changes are made by either the Ansible role or the Ansible Packages job, although the Ansible Packages job reports that it completed successfully. After changing the value of the "ansible_roles_check_mode" parameter back to false, re-running the Ansible Packages job successfully installs the package.

Comment 7 Sam Bible 2022-04-25 18:53:03 UTC
Verified on Satellite 6.11 - 16

Steps to Test:
1. Register a RHEL 7 host to Satellite 6.10 and assign an Ansible role.
2. In the Satellite webUI, navigate to Hosts > All Hosts > [hostname] > Edit > Parameters tab.
3. In the "Global Parameters" section, click the "Override" button in the "Actions" column for the "ansible_roles_check_mode" parameter.
4. In the "Host Parameters" section, change the value of the "Value" field from "false" to "true" for the "ansible_roles_check_mode" parameter.
5. Select the "Run Ansible roles" option.
6. When the job completes, navigate back to Hosts > All Hosts > [hostname] and select the "Schedule Remote Job" option.
7. Select the "Ansible Packages" job category and the "Package Action - Ansible Default" job template, set the state to "present," enter a package that is not currently installed on the host in the "name" field, then click the "Submit" button.

Expected Results:
No changes are made when the Ansible role is run on the host, but the Ansible Packages job successfully installs the package.

Actual Results: 
No changes are made when the Ansible role is run on the host, but the Ansible Packages job successfully installs the package.

Comment 10 errata-xmlrpc 2022-07-05 14:29:34 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.