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
my code for the role is:
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
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)
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)
Hi @Travis
Thanks for your reply i downloaded the role using dnf install rhel-system-roles.
for the command of ansible-galaxy list the remainig roles aren't shown in the picture but rhel-system-roles.selinux exists.
sorry the output doesn't fit into single picture.
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
@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.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.