cancel
Showing results for 
Search instead for 
Did you mean: 
khokha
Flight Engineer
Flight Engineer
  • 1,554 Views

Hello everyone,

I installed redhat roles using dnf install rhel-system-roles command.

my roles_path= /usr/share/ansible/roles:/etc/ansible/roles:/home/user/roles

when i do ansible-galaxy list the roles exist.

but when i run the playbook i get this error

error-role.png

my code for the role is:

code.png

i even tried using it in roles section but it gives error with syntax-check even before i run the playbook.

I tried writing different syntax: rhel-system-roles.selinux but the same error.

 

Thanks

1 Solution

Accepted Solutions
Travis
Moderator
Moderator
  • 1,536 Views

Get the output of the following:

ansible-galaxy collection list

ansible-galaxy list

If you installed from the RPM, it is from the collection or as the independent role depending on how you installed it. Keep in mind that roles and collections installed from RPM packages differ a little bit from a role installed directly using the Ansible Galaxy command. The error indicates it can't find the role, so I would try the above commands and I would also list out the directory 

/usr/share/ansible/roles/ (where the RPM will install)

 

rhel-system-roles.selinux (Independent Role name)

or

redhat.rhel_system_roles.selinxrhel-system-roles.selinux (FQCN)

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training

View solution in original post

4 Replies
Travis
Moderator
Moderator
  • 1,537 Views

Get the output of the following:

ansible-galaxy collection list

ansible-galaxy list

If you installed from the RPM, it is from the collection or as the independent role depending on how you installed it. Keep in mind that roles and collections installed from RPM packages differ a little bit from a role installed directly using the Ansible Galaxy command. The error indicates it can't find the role, so I would try the above commands and I would also list out the directory 

/usr/share/ansible/roles/ (where the RPM will install)

 

rhel-system-roles.selinux (Independent Role name)

or

redhat.rhel_system_roles.selinxrhel-system-roles.selinux (FQCN)

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training
khokha
Flight Engineer
Flight Engineer
  • 1,515 Views

Hi @Travis 

Thanks for your reply i downloaded the role using dnf install rhel-system-roles.

c1.pngc2.pngfor the command of ansible-galaxy list the remainig roles aren't shown in the picture but rhel-system-roles.selinux exists.

c3.pngc4.png

sorry the output doesn't fit into single picture.

 

bcpenguin
Cadet
Cadet
  • 30 Views

Just to be clear. This question relates to a lab in a class, not the exam.

Solution:

1. Download specific version of rhe-system-roles required to work with ansible-navigator

https://github.com/Manilehra09/Ansible/blob/main/redhat-rhel_system_roles-1.19.3.tar.g

2. Copy to control node and install

ansible-galaxy collection install -p collections/ redhat-rhel_system_roles-1.19.3.tar.gz 

3. Change example playbooks, changing role name from rhel-system-role.timesymc and rhel-system-role.selinux to redhat.rhel_system_roles.timesync and redhat.rhel_system_roles.selinux

0 Kudos
Travis
Moderator
Moderator
  • 13 Views

@bcpenguin and @khokha -

Again, this goes back to how you use the roles and how you execute the playbook. The roles installed via the DNF use the RPM which installs those to your local RHEL system. Yes, while the roles are in your path, they are not mounted within the Ansible Execution Environment that the ansible-navigator command uses. The only roles mapped in there are the roles stored from your local project (current working directory).

Unfortunately, the RHEL System ROLES is named a little differently if you use the RPM installation vs. the AAP Collection TGZ file from Ansible Automation Hub.

/usr/share/ansible/roles/ (where the RPM will install)

rhel-system-roles.selinux (Independent Role name)

or

redhat.rhel_system_roles.selinxrhel-system-roles.selinux (FQCN)

This is from the comments above. Look in the book as there is a note in the lecture section about RHEL System roles and the various methods those can be installed.

Hope this helps.

 

Screenshot 2025-01-13 at 9.07.29 AM.png

 

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training
0 Kudos
Join the discussion
You must log in to join this conversation.