Generate an HTML report on your Red Hat subscriptions usage in your Satellite system, on a per-host basis.
Useful during renewals and for troubleshooting purposes.
This Ansible playbook queries the Satellite's Hosts API with your filter of choice, and for each host, it queries its data.
The data is then used to compile the HTML report. For each playbook run with a different query, the results are added to the final report.
The playbook never makes logins to the Hosts.
The best use for this playbook is to be run from the Satellite server itself. It does not make use of the Foreman Ansible modules. But it makes full use of Ansible's multithreaded task execution, so be sure to crank up your forks
in your ansible.cfg
.
Use the satellite-vars.yml.example file to create your own satellite-vars.yml
file. You should set your Satellite's URL and credentials with read access to hosts and subscriptions (i.e. the Viewer role).
Run the playbook with your query of choice:
$ ansible-playbook main.yml \
-e satellite_hosts_search_query="' os_title \!~ centos or hypervisor = true '
(based on your Bash version, you might or might not need that extra backslash before the exclamation mark)
You can run the playbook multiple times with different queries, and since the previous query results are cached, the results are added to the new report.
If you run it with the same query twice, those hosts' data is refreshed.
To clean up all the cache, simply remove all .json
files from the cache directory.
The report is a left join between the Hosts list and its subscriptions. It means, for each Host, it is shown multiple times - once for each subscription attached - and once if no subscriptions are attached.
Each hyperlink brings you to a handy page where to apply modifications, i.e.:
- A host's FQDN with no subscriptions: to the Add Subscriptions page
- A host's FQDN with subscriptions: to the List/Remove Subscriptions page
- A Subscription's name: to the Subscription Info page
- A CSV report maybe