TPeters
Flight Engineer
Flight Engineer
  • 976 Views

rhel-system-roles ? rhel_system_roles ???

I have been doing Lab Review of Chapter 7 . The playbook needs to use the selinux role from the RHEL system roles.

Now first we are required to install the collection redhat-rhel_system_roles-1.19.3.tar.gz, which end up in /home/student/role-review/collections/ansible_collections/redhat/rhel_system_roles/ : note (which I didn't) the underscores '_' in the collection name.

Now at step 10, we are instructed to include the rhel-system-roles.selinux role into the web_dev_server.yml playbook. Note the dashes '-' in the role name.

This is utterly confusing. In the solution shown, it becomes clear (after close scrutiny) that we must:

1) put "redhat." in front.

2) use underscores in the name, not dashes.

The solution refers for documentation to /usr/share/doc/rhel-system-roles/selinux/example-selinux-playbook.yml , which is indeed a rhel-system-role with dashes.

When I use rhel-system-roles.selinux or redhat.rhel-system-roles.selinux in my playbook and run it, Ansible complains:

TASK [include_role : rhel-system-roles.selinux] ********************************
ERROR! the role 'rhel-system-roles.selinux' was not found in /home/student/role-review/roles:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/student/role-review

Which is puzzling bacause the role does exist on the workstation and the path is in the paths list that is in the error message:

[student@workstation role-review]$ ls -ld /usr/share/ansible/roles/rhel-system-roles.selinux/
drwxr-xr-x. 9 root root 4096 Sep 15 2022 /usr/share/ansible/roles/rhel-system-roles.selinux/

It took me a while to realize that the rhel-system-roles are not in the execution environment that ansible-navigator is using.

On the other hand, the collection is under ./collections/ which is in the collections_path defined in the ansible.cfg, so that CAN be included.

So @redhat: please fix the Lab Review to mention the correct collection name in the instruction.

This cost me 2 hours to figure out.

Also I like to mention that the inconsistent use of dashes and underscores by Ansible and RedHat is very frustrating. As are things like:

`ansible-galaxy collection list` vs.

`ansible-navigator collections list`

Way too many ideosyncracies to remember!!!

 

 

2 Replies
DRobitaille
Flight Engineer
Flight Engineer
  • 966 Views

Totally agree.  That also confused me for a bit while doing RH294.  And it makes me wonder which syntax and style of system-roles to expect when I do EX294 in a couple of weeks.

pluizetto
Cadet
Cadet
  • 499 Views

I solved it by installing the collection that the .tar.gz file provides:

[student@workstation role-review]$ ansible-galaxy collection install redhat-rhel_system_roles-1.19.3.tar.gz
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'redhat.rhel_system_roles:1.19.3' to '/home/student/role-review/collections/ansible_collections/redhat/rhel_system_roles'
redhat.rhel_system_roles:1.19.3 was installed successfully
[student@workstation role-review]$


Join the discussion
You must log in to join this conversation.