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?
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.