Interface with API from Provisioning System


I have a scenario that I want to query and update things in Foreman from a system while it is being provisioned.

For example in my kickstart template, in the %post section, I would like to update the host’s name in Foreman.

I could probably use curl or a python script to update it via the API, but I am wondering if there is a better method of doing things like that? Maybe hammer can be called from the installatiom environment somehow?

Any tips would be much appreciated!

That’s quite unsecure workflow, you’d need to expose Foreman credentials via unattended template which is available to anyone with token over HTTP. We do have foreman_hooks plugin which allows you to start shell scripts on various events. We are developing foreman_webhooks plugin which will provide much better integration workflow. I’d suggest to use this once we finish this.

Ah yes, that was going to be my follow up question, which is would there be a way to securely accomplish what I’m looking to do.

Thank you very much for your advice. I will look into the foreman_hooks plugin and review foreman_webhooks once it is released.