I am trying to associate a VM that was created outside of foreman with a foreman host that was created specifically for that VM.
There is suited REST like: https://foreman-server/compute_resources/MyDatacenter/vms/MyHostName/associate
similar to API documentation
but to only request association for single, given VM.
Foreman and Proxy versions:
What is the reason that there is REST Call for disassociation of VM but not for the reverse operation ?
PUT /api/hosts/:id/disassociate : API documentation
The association part is in compute resource API: API documentation. Would it make sense to have the endpoint also in hosts?
If I understand it right this call is meant to associate all vms, isn’t it ?
… which is not exactely what we need. Because associating all VMs is a much heavier operation.
Correct, I missed that. Back to the original question - the API feature is tracked in this issue Feature #4155: API for CR association and disassociation - Foreman which wants to make API on par with UI. I didn’t found a way how to associate specific host with a VM and that may be reason why it was not added to the API later. You may create new related feature request to track what you need to be added.
May I ask: Why it is more difficult with REST API than doing it with Web GUI ?