Safe area to run web scripts from on Katello server?

Problem:
I’d like to install a couple of simple scripts on my Katello server to allow some simple functions and/or data to be extracted when a URL is hit. Is there a recommended area on a Katello server

Expected outcome:
Want clients to be able to hit a URL and find out health statistics about the Satellite. This would allow clients to spread out their patching to smooth out any nasty lumps during patching weekend. Or bulk batches of new registrations could spread themselves out to avoid overloading the Katello server.
I’m also hoping to create a URL which a client could hit to change their Content View. We datestamp CCVs on release, but sometimes Prod clients are not ready to patch using our latest release, so need to move to the previous release before the patching window arrives.

Looking for something which can be managed discretely away from the Katello services.

On Spacewalk I could put things in the cgi-bin folder and turn that on. Is there anything similar available on a Katello server which wouldn’t be overwritten or disabled during a patching/upgrade/foreman-install operation?

Thanks

Duncan Innes

Hi @Duncan_Innes,

I’m not sure myself what would be safe, since the installer does manage a lot. Perhaps try adding some scripts similarly like you did with Spacewalk and then run foreman-installer alone to see if it gets reset. You can bring up a quick test Katello server using Forklift if you don’t want to do this test on your production server.

What kind of health information do you want? There might be an endpoint that is already available that you could use.

Perhaps this API endpoint could already satisfy this?
/apidoc/v2/hosts_bulk_actions/environment_content_view.html

Here’s a cURL example that I just tried out on Katello 4.0:

curl -u user:password -X PUT -H "Content-Type: application/json" -d '{"organization_id": 1, "included": {"search": "foreman.example.com"}, "environment_id": 1, "content_view_id": 1}'  https://foreman.example.com/api/hosts/bulk/environment_content_view

It’ll spawn a bulk task to change the content view and/or lifecycle environment for any number of hosts.

1 Like

Hi,

The types of information were looking for are Lifecycle Environment and Content View mainly. We considered the API route, but the Sys Admins are not allowed access to the Satellite, so having any kind of user/password or token is a no-go for us.

We developed a small web API to run on a separate server. This takes the requestor IP address and matches it against the UUID which is provided in the URL before answering the query or allowing edits. Works great so far, but at the cost of having another server to keep alive. Being able to run this on the Katello server would be much better for us.

I’ll have a look again, but everywhere I looked so far gets blanked by the installer.

D