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 1893906 - [8.4] Package rhel-system-roles in the collection format in addition to the legacy role format
Summary: [8.4] Package rhel-system-roles in the collection format in addition to the l...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rhel-system-roles
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.4
Assignee: Pavel Cahyna
QA Contact: David Jež
Eliane Ramos Pereira
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-02 22:46 UTC by Pavel Cahyna
Modified: 2021-05-18 16:02 UTC (History)
2 users (show)

Fixed In Version: rhel-system-roles-1.0.0-25.el8
Doc Type: Enhancement
Doc Text:
.An alternative to the traditional RHEL System Roles format: Ansible Collection RHEL 8.4 introduces RHEL System Roles in the Collection format, available as an option to the traditional RHEL System Roles format. This update introduces the concept of a fully qualified collection name (FQCN), that consists of a namespace and the collection name. For example, the Kernel role fully qualified name is: `redhat.rhel_system_roles.kernel_settings` * The combination of a namespace and a collection name guarantees that the objects are unique. * The combination of a namespace and a collection name ensures that the objects are shared across the Collections and namespaces without any conflicts. Install the Collection using an RPM package. Ensure that you have the `python3-jmespath` installed on the host on which you execute the playbook: [literal] ---- # yum install rhel-system-roles ---- The RPM package includes the roles in both the legacy Ansible Roles format as well as the new Ansible Collection format. For example, to use the network role, perform the following steps: Legacy format: [literal] --- - hosts: all roles: rhel-system-roles.network Collection format: [literal] --- - hosts: all roles: redhat.rhel_system_roles.network If you are using Automation Hub and want to install the System Roles Collection hosted in Automation Hub, enter the following command: [literal] ---- $ ansible-galaxy collection install redhat.rhel_system_roles ---- Then you can use the roles in the Collection format, as previously described. This requires configuring your system with the ansible-galaxy command to use Automation Hub instead of Ansible Galaxy. See link:https://docs.ansible.com/ansible/devel/user_guide/collections_using.html#configuring-the-ansible-galaxy-client[How to configure the `ansible-galaxy` client to use Automation Hub instead of Ansible Galaxy] for more details.
Clone Of:
Environment:
Last Closed: 2021-05-18 16:02:26 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Pavel Cahyna 2020-11-02 22:46:37 UTC

Comment 1 Pavel Cahyna 2020-12-10 22:28:42 UTC
Will need a rebase of all the roles, there were changes needed to support collections.

Comment 2 Pavel Cahyna 2020-12-14 13:18:43 UTC
There are two possible approaches to testing of collections.

First is to use the tests in the collection (converted role tests) under  /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/ and run them using the Upstream-testsuite and/or the basic-smoke-test wrappers. This will require some changes to the wrappers and fixing RHELPLAN-61752, because right now the tests are not converted properly. All the tests will then be executed twice, once for the collection and second time for the legacy role, which is probably not a big problem.

Second possibility is to add a really basic smoke test that checks that the role can be imported from the collection for every role. The playbook looks like (replace fedora by redhat and linux_system_roles by rhel_system_roles for downstream testing):

- hosts: localhost
  collections:
    - fedora.linux_system_roles
  tasks:
    - import_role:
        name: storage
      when: false

If executed on a host where the collection is not installed, it fails:
-----
ERROR! the role 'storage' was not found in fedora.linux_system_roles:ansible.legacy:/home/pcahyna/ansible_pokusy/collections/roles:/home/pcahyna/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/pcahyna/ansible_pokusy/collections

The error appears to be in '/home/pcahyna/ansible_pokusy/collections/simplecollectionimport.yml': line 6, column 15, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - import_role:
        name: storage
              ^ here
-----

When the package with collection is installed, it runs:
-----
ansible-playbook -i localhost, simplecollectionimport.yml 

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
[DEPRECATION WARNING]: Distribution fedora 32 on host localhost should use 
/usr/bin/python3, but is using /usr/bin/python for backward compatibility with 
prior Ansible releases. A future Ansible release will default to using the 
discovered platform python for this host. See https://docs.ansible.com/ansible/
2.9/reference_appendices/interpreter_discovery.html for more information. This 
feature will be removed in version 2.12. Deprecation warnings can be disabled 
by setting deprecation_warnings=False in ansible.cfg.
ok: [localhost]

TASK [fedora.linux_system_roles.storage : Set version specific variables] ******
skipping: [localhost]

TASK [fedora.linux_system_roles.storage : define an empty list of pools to be used in testing] ***
skipping: [localhost]

TASK [fedora.linux_system_roles.storage : define an empty list of volumes to be used in testing] ***
skipping: [localhost]

TASK [fedora.linux_system_roles.storage : include the appropriate provider tasks] ***
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0   
-----

Such test playbook can be easily autogenerated to test all roles in the package.

Comment 13 errata-xmlrpc 2021-05-18 16:02:26 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 (rhel-system-roles bug fix and enhancement update), 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/RHEA-2021:1909


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