Bug 1893906
| Summary: | [8.4] Package rhel-system-roles in the collection format in addition to the legacy role format | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Pavel Cahyna <pcahyna> |
| Component: | rhel-system-roles | Assignee: | Pavel Cahyna <pcahyna> |
| Status: | CLOSED ERRATA | QA Contact: | David Jež <djez> |
| Severity: | unspecified | Docs Contact: | Eliane Ramos Pereira <elpereir> |
| Priority: | unspecified | ||
| Version: | 8.3 | CC: | djez, rmeggins |
| Target Milestone: | rc | Keywords: | FutureFeature, Rebase, Triaged |
| Target Release: | 8.4 | Flags: | pcahyna:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| 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.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-18 16:02:26 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
Pavel Cahyna
2020-11-02 22:46:37 UTC
Will need a rebase of all the roles, there were changes needed to support collections. 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.
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 |