Bug 1983195

Summary: Roles imported from a collection installed to /etc/ansible/collections are not found when run on hosts
Product: Red Hat Satellite Reporter: Danny Synk <dsynk>
Component: AnsibleAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: mhulan, oezr, oprazak, smallamp, zhunting
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-installer-2.5.2.2-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:12:49 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:

Description Danny Synk 2021-07-16 19:37:05 UTC
Description of problem:
If an Ansible collection is installed on Satellite to /etc/ansible/collections, the roles from the collection are imported to Satellite, and roles from that collection are then assigned to a host, Satellite is unable to find those roles when Ansible roles are run on the host. 

Version-Release number of selected component (if applicable):
Satellite 6.10, snap 9
tfm-rubygem-foreman_ansible-6.3.1-1.el7sat.noarch
tfm-rubygem-smart_proxy_ansible-3.1.0-1.el7sat.noarch

How reproducible:
100%

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 Satellite webUI.
3. Register a host to Satellite 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 Satellite 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 Dynflow console entry for the task:

~~~
  - output_type: stdout
    output: "\r\nTASK [Apply roles] *************************************************************\n"
    timestamp: 1626461088.7711945
  - output_type: stdout
    output: "\n"
    timestamp: 1626461088.7712917
  - output_type: stdout
    output: "\n"
    timestamp: 1626461088.771384
  - output_type: stdout
    output: "\n"
    timestamp: 1626461088.7714665
  - output_type: stdout
    output: "\n"
    timestamp: 1626461088.7716033
  - output_type: stdout
    output: '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 Satellite, those roles run successfully after being assigned to a host.

Comment 3 Ondřej Pražák 2021-07-28 11:26:55 UTC
Created redmine issue https://projects.theforeman.org/issues/33162 from this bug

Comment 4 Bryan Kearney 2021-07-28 12:06:13 UTC
Upstream bug assigned to oprazak@redhat.com

Comment 5 Bryan Kearney 2021-07-28 12:06:17 UTC
Upstream bug assigned to oprazak@redhat.com

Comment 6 Bryan Kearney 2021-07-28 20:03:30 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33162 has been resolved.

Comment 8 Danny Synk 2021-08-20 15:48:17 UTC
Verified on Satellite 6.10, snap 14.

Steps to test:

1. Install an Ansible Collection to /etc/ansible/collections.
2. Import the roles from the collection on the Configure > Roles page of the Satellite webUI.
3. Register a host to Satellite and configure it for remote execution with the Global Registration Template.
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 Satellite webUI.

Expected results:
Roles in an Ansible Collection installed to /etc/ansible/collections run successfully on hosts.

Actual results:
Roles in an Ansible Collection installed to /etc/ansible/collections run successfully on hosts.

Comment 11 errata-xmlrpc 2021-11-16 14:12:49 UTC
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 (Moderate: Satellite 6.10 Release), 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/RHSA-2021:4702