theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 163 forks source link

add a host_subscription module #509

Open evgeni opened 4 years ago

evgeni commented 4 years ago
SUMMARY

@stroobl has written a satellite_subscription module, that can manage the subs attached to a host in Katello/Satellite. As this is not going to be shipped in Ansible, I think we should have such a module in our collection, probably named katello_host_subscription or similar (I'd prefer not to bloat foreman_host with such Katello-specific details).

ISSUE TYPE
stroobl commented 4 years ago

I also has a companion module to generate a csv report with more detailed information than what you can currently get from Satellite: an overview with totals (free/used/total) per subscription type and a list of subscriptions attached per host. However, all this is written with Satellite and paid Red Hat subscriptions in mind. I never used the free Katello version, so I'm not sure if everything applies here and how much changes it needs to be fully functional here.

mdellweg commented 4 years ago

I agree, this sounds like a perfect match. Sure, it would need some refactoring, but i believe it can even benefit from our foreman_helper infrastructure. @stroobl willing to have a look?

evgeni commented 4 years ago

Katello and Satellite are API compatible (as long as you look at similar versions), so that should be not an issue.

Can you add a link to your reporting module please?

mdellweg commented 4 years ago

Maybe, the report for available subscriptions falls in the realms of the foreman_search_facts module.

sean797 commented 4 years ago

:+1: to adding the module here. I'm not sure I agree with the katello_host_subscription name, in future, were should we add functionality to change a Katello Host's Life Cycle Env, Content View or other Katello attributes? Maybe katello_host? Then there is the argument that we shouldn't have katello_host as we don't have separate modules for other plugins. I think I'd prefer either adding it to a new katello_hosts module or foreman_host?

Maybe, the report for available subscriptions falls in the realms of the foreman_search_facts module.

Agreed! I'd take a PR to add a CSV output flag :smile:

stroobl commented 4 years ago

I made PR #518 with the current source code of our modules, since I have no idea how you want to start with this. I know this won't be accepted in it's current state, but it's easier to discuss if you see what we're talking about. :)

ehelms commented 4 years ago

We could follow the UI and name it either katello_content_host_subscription or foreman_content_host_subscription. Internally, this is achieved through facets which provides another option foreman_host_subscription_facet. I am not sure there is a clear answer other than picking something that is easy for users to map to concepts in the UI/API.