Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1810600 - [RFE] Ansible Role execution reports are not exactly human readable
Summary: [RFE] Ansible Role execution reports are not exactly human readable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.6.0
Hardware: All
OS: All
high
medium
Target Milestone: 6.10.0
Assignee: satellite6-bugs
QA Contact: Danny Synk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-05 14:53 UTC by Jan Jansky
Modified: 2024-04-14 04:25 UTC (History)
14 users (show)

Fixed In Version: ansible-collection-redhat-satellite-2.1.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32189 0 Normal Ready For Testing Improve ansible config report data 2021-05-26 09:57:22 UTC
Github theforeman foreman-ansible-modules pull 1232 0 None Merged Fixes #32189 - add task action to callback 2021-09-14 17:13:55 UTC
Red Hat Knowledge Base (Solution) 5897841 0 None None None 2021-03-22 20:39:56 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:18 UTC

Description Jan Jansky 2020-03-05 14:53:43 UTC
Description of problem: When Ansible Roles are executed Ansible report is create, but it is marked in reports with origin N/A instead of Ansible, also output in Ansible report is in json, which is not exactly human readable output


Version-Release number of selected component (if applicable):
tfm-rubygem-foreman_ansible-3.0.7.1-1.el7sat.noarch
ansible-2.8.8-1.el7ae.noarch


How reproducible: Always


Steps to Reproduce:
1. Create host with attached ansible roles
2. WebUI -> All Hosts -> Select Host -> Select Action -> Play Ansible roles
3. Wait until finished
4. WebUI -> Monitor -> Config Management
5. remove filter
6. select Ansible report

Actual results:
in step 5. you see N/A origin instead of Ansible origin
in step 6. you see json output

for example:

{"foreman": {"owner_name": "Admin User", "foreman_host_collections": [], "content_view_info": {"published": "2020-03-05T13:33:55.111Z", "version": "2.0", "latest-version": "2.0", "components": {}, "label": "RHEL8"}, "ssh_authorized_keys": [], "domainname": "x.example.com", "owner_email": "root.com", "root_pw": "example", "location_title": "LOCATION", "foreman_users": {"admin": {"name": "admin", "ssh_authorized_keys": [], "mail": "root.com", "firstname": "Admin", "lastname": "User", "fullname": "Admin User", "description": null}}, "lifecycle_environment": "LE", "kt_cv": "CV", "foreman_env": "common", "puppet_ca": "ca.x.example.com", "foreman_subnets": [{"dns_primary": "127.0.0.1", "network_type": "IPv4", "from": "192.168.1.2", "description": "", "name": "192.168.1.254", "ipam": "DHCP", "mask": "255.255.255.0", "vlanid": null, "mtu": 1500, "to": "192.168.1.10", "dns_secondary": "", "gateway": "192.168.1.1", "network": "192.168.1.10", "boot_mode": "DHCP"}], "foreman_config_groups": [], "foreman_domain_description": "", "content_view": "CV", "hostgroup": "CV/CV-prod", "kickstart_repository": "Red_Hat_Enterprise_Linux_8_for_x86_64_-_BaseOS_Kickstart_x86_64_8_1", "organization_title": "ORG", "puppetmaster": "sat.x.example.com", "kt_env": "common", "location": "LOC", "foreman_interfaces": [{"managed": true, "ip": "192.168.1.10", "primary": true, "mac": "AA:BB:CC:DD:EE:FF", "tag": null, "ip6": null, "attrs": {"netmask6": "ffff:ffff:ffff:ffff::", "network": "192.168.1.10", "bindings6": [{"netmask": "ffff:ffff:ffff:ffff::", "network": "fe80::", "address": "fe80::5054:ff:fe9b:ef84"}], "mtu": 1500, "netmask": "255.255.255.0", "network6": "fe80::", "dhcp": "192.168.1.10", "bindings": [{"netmask": "255.255.255.0", "network": "192.168.1.10", "address": "192.168.1.10"}]}, "subnet6": null, "provision": true, "subnet": {"dns_primary": "127.0.0.1", "network_type": "IPv4", "from": "192.168.1.2", "description": "", "name": "192.168.1.10", "ipam": "DHCP", "mask": "255.255.255.0", "vlanid": null, "mtu": 1500, "to": "192.168.1.254", "dns_secondary": "", "gateway": "192.168.1.1", "network": "192.168.1.10", "boot_mode": "DHCP"}, "attached_to": null, "name": "host.x.example.com", "virtual": false, "link": true, "identifier": "ens3", "type": "Interface"}], "organization": "ORG"}, "changed": false, "_ansible_verbose_always": true, "_ansible_no_log": false}

Expected results:
Icon for Ansible report.
Human readable output

Comment 8 Shira Maximov 2020-04-20 07:51:41 UTC
In this bug, we have to separate issue: 
1. An RFE to present the logs in a different way. 
2. A BZ -> reports do not show Ansible Icon 

so I'm splitting those two issues:
I've created another issue for BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1825761 and I'm changing this one to be an RFE.

Comment 10 Shira Maximov 2020-04-20 07:53:37 UTC
Created redmine issue https://projects.theforeman.org/issues/29572 from this bug

Comment 11 Marek Hulan 2021-02-16 10:45:55 UTC
Regarding the N/A origin, the problem is in the foreman.py callback that is shipped in the latest Ansible release. In order to fix that, the foreman.py from the satellite ansible collection is required. The most straightforward way to fix that is this:

wget https://raw.githubusercontent.com/RedHatSatellite/satellite-ansible-collection/develop/plugins/callback/foreman.py -O /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py

I tested this with Ansible 2.9.16 and it fixes the problem. Once the report is correctly recognized as Ansible, the JSONs are parsed and you can interactively navigate through their structure. Longer term, it's planned to create a textual representation of these JSONs.

Comment 12 Marek Hulan 2021-02-16 12:31:51 UTC
Or actually better, install the RPM from Satellite repos and reconfigure Capsule to use this callback instead

foreman-maintain packages unlock
yum install ansible-collection-redhat-satellite
foreman-maintain packages lock

edit the /etc/foreman-proxy/ansible.cfg and change the line

> callback_whitelist = foreman
to
> callback_whitelist = redhat.satellite.foreman

The origin is then recognized (at least with 6.9 beta) and JSONs properly clickable.

Comment 15 Bryan Kearney 2021-05-28 10:16:01 UTC
Upstream bug assigned to ymakias

Comment 16 Bryan Kearney 2021-05-28 10:16:04 UTC
Upstream bug assigned to ymakias

Comment 17 Bryan Kearney 2021-06-08 08:00:43 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32189 has been resolved.

Comment 22 Danny Synk 2021-09-27 15:39:11 UTC
Verified on Satellite 6.10, snap 20 (tfm-rubygem-foreman_ansible-6.3.4-1.el7sat.noarch).

Steps to Test:

1. Register a RHEL host to Satellite 6.10.
2. Assign Ansible roles to the host.
3. On the Hosts > All Hosts > [hostname] page, select the "Run Ansible Roles" option.
4. When the job completes, navigate to Monitor > Config Management, and open the report for the job.

Expected Results:
The report is in a more readable format than the equivalent report on Satellite 6.9 and earlier, which presents the outcome of the job in a single line of unformatted JSON.

Actual Results:
The report table now has four columns (Level, Module, Arguments, and Message) in contrast to the old report's 3 columns (Level, Resource, and Message). The Arguments and Message column still display JSON, but each key/value pair is now separated by line breaks. Lists of keys can be expanded or collapsed. Keys are color coded blue, and different data types are color coded as well (my report shows string data in light green and boolean values in red).

Comment 25 errata-xmlrpc 2021-11-16 14:09:07 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

Comment 26 Red Hat Bugzilla 2024-04-14 04:25:27 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


Note You need to log in before you can comment on or make changes to this bug.