Bug #33162
closedRoles imported from a collection installed to /etc/ansible/collections are not found when run on hosts
Description
Description of problem:
If an Ansible collection is installed on Foreman to /etc/ansible/collections, the roles from the collection are imported to Foreman, and roles from that collection are then assigned to a host, Foreman is unable to find those roles when Ansible roles are run on the host.
Steps to Reproduce:
1. Install an Ansible Collection to /etc/ansible/collections:
# ansible-galaxy collection install ericsysmin.system -p /etc/ansible/collections/
2. Import the roles from the collection on the Configure > Roles page of the Foreman webUI.
3. Register a host to Foreman and configure it for remote execution.
4. Assign one or more roles from the collection to the host.
5. Select the "Run Ansible roles" option from the Hosts > All Hosts > [hostname] page of the Foreman webUI.
Actual results:
The task appears to complete successfully, but the roles from the collection are not actually run. The following error appears in the console entry for the task:
ERROR! the role 'ericsysmin.system.chrony' was not found in /tmp/d20210716-9401-1q84fq9/project/roles:/etc/ansible/roles:/usr/share/ansible/roles:/tmp/d20210716-9401-1q84fq9/project
Expected results:
Roles in an Ansible Collection installed to /etc/ansible/collections run successfully on hosts.
Additional info:
If the same collection is installed to /usr/share/ansible/collections and the roles from the collection are imported to Foreman, those roles run successfully after being assigned to a host.