This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 2105162 - Can't run Ansible playbooks on RHEL 9 with ansible-core
Summary: Can't run Ansible playbooks on RHEL 9 with ansible-core
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: scap-security-guide
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Marcus Burghardt
QA Contact: BaseOS QE Security Team
Jan Fiala
URL:
Whiteboard:
Depends On:
Blocks: 2114981
TreeView+ depends on / blocked
 
Reported: 2022-07-08 07:16 UTC by Marko Myllynen
Modified: 2023-09-23 17:45 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
.Ansible remediations require additional collections With the replacement of Ansible Engine by the `ansible-core` package, the list of Ansible modules provided with the RHEL subscription is reduced. As a consequence, running remediations that use Ansible content included within the `scap-security-guide` package requires collections from the `rhc-worker-playbook` package. For an Ansible remediation, perform the following steps: . Install the required packages: + ---- # dnf install -y ansible-core scap-security-guide rhc-worker-playbook ---- . Navigate to the `/usr/share/scap-security-guide/ansible` directory: + ---- # cd /usr/share/scap-security-guide/ansible ---- . Run the relevant Ansible playbook using environment variables that define the path to the additional Ansible collections: + [subs="+quotes",options="nowrap",role="white-space-pre"] ---- # ANSIBLE_COLLECTIONS_PATH=/usr/share/rhc-worker-playbook/ansible/collections/ansible_collections/ ansible-playbook -c local -i localhost, rhel9-playbook-_cis_server_l1_.yml ---- + Replace `_cis_server_l1_` with the ID of the profile against which you want to remediate the system. As a result, the Ansible content is processed correctly. [NOTE] ==== Support of the collections provided in `rhc-worker-playbook` is limited to enabling the Ansible content sourced in `scap-security-guide`. ====
Clone Of:
: 2114981 (view as bug list)
Environment:
Last Closed: 2023-08-30 10:54:42 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-1800 0 None Migrated None 2023-08-30 10:54:34 UTC
Red Hat Issue Tracker RHELPLAN-127279 0 None None None 2022-07-08 07:24:54 UTC

Description Marko Myllynen 2022-07-08 07:16:26 UTC
Description of problem:
On a RHEL 9 server/minimal installation without non-RHEL Ansible bits installed it seems not possible to run SCAP playbooks locally in an offline (non-RH connected) environment:

# rm -rf ~/.ansible
# dnf install -y ansible-core scap-security-guide
# cd /usr/share/scap-security-guide/ansible
# ansible-playbook -c local -i localhost, rhel9-playbook-cis_server_l1.yml
ERROR! couldn't resolve module/action 'ini_file'. This often indicates a
misspelling, missing collection, or incorrect module path.
...

Version-Release number of selected component (if applicable):
ansible-core-2.12.2-1.el9.x86_64
openscap-1.3.6-3.el9.x86_64
openscap-scanner-1.3.6-3.el9.x86_64
scap-security-guide-0.1.60-6.el9_0.noarch

Comment 11 Benjamin Blasco 2022-08-03 11:46:10 UTC
Hello, I have just tested this on a fully updated RHEL 9 system (deployed from qcow) and it does not work unless you export the ANSIBLE_COLLECTIONS PATH:

[root@rhel90 ansible]# ANSIBLE_COLLECTIONS_PATH=/usr/share/rhc-worker-playbook/ansible/collections/ansible_collections/

[root@rhel90 ansible]#  ansible-playbook -i localhost -c local rhel9-playbook-cis_server_l1.yml 
[WARNING]: Unable to parse /usr/share/scap-security-guide/ansible/localhost as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all'
ERROR! couldn't resolve module/action 'ini_file'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/usr/share/scap-security-guide/ansible/rhel9-playbook-cis_server_l1.yml': line 340, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - name: Ensure GPG check is globally activated
      ^ here
[root@rhel90 ansible]# 

All that needs to change from the above is the following line to include "export"
[root@rhel90 ansible]# ANSIBLE_COLLECTIONS_PATH=/usr/share/rhc-worker-playbook/ansible/collections/ansible_collections/

Package versions:
openscap-1.3.6-3.el9.x86_64
openscap-scanner-1.3.6-3.el9.x86_64
scap-security-guide-0.1.60-6.el9_0.noarch
ansible-core-2.12.2-1.el9.x86_64
rhc-worker-playbook-0.1.8-1.el9.x86_64

After the correction I have encountered an issue that appears to be with the playbook or my deployment, rather than Ansible module inclusions:

TASK [Check the integrity of the current authselect profile] ************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["authselect", "check"], "delta": "0:00:00.012932", "end": "2022-08-03 21:44:42.908747", "msg": "non-zero return code", "rc": 2, "start": "2022-08-03 21:44:42.895815", "stderr": "", "stderr_lines": [], "stdout": "System was not configured with authselect.", "stdout_lines": ["System was not configured with authselect."]}
...ignoring

TASK [Informative message based on the authselect integrity check result] ***********************************************
fatal: [localhost]: FAILED! => {
    "assertion": "result_authselect_check_cmd is success",
    "changed": false,
    "evaluated_to": false,
    "msg": [
        "authselect integrity check failed. Remediation aborted!",
        "This remediation could not be applied because the authselect profile is not intact.",
        "It is not recommended to manually edit the PAM files when authselect is available.",
        "In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended."
    ]
}

Happy to collect more info as needed.

Comment 12 Benjamin Blasco 2022-08-03 12:25:23 UTC
Please note that later error with authselect in the previous comment was due to an issue with my authselect configuration, which has nothing to do with this BZ.

Comment 13 Rich Megginson 2022-08-03 13:57:29 UTC
You don't have to use the environment variable.  You can also use an ansible config setting https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths in various places: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file

Comment 15 Gabi Fialová 2022-08-04 14:09:17 UTC
This release note has been published in 9.0: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/9.0_release_notes/index

Comment 21 RHEL Program Management 2023-08-30 09:58:15 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 22 RHEL Program Management 2023-08-30 10:54:42 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues.


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