Implement REST or something similar?
It would be useful (at least for me) to be able to add a host to Foreman via a REST call or a similar API. I think this would come in useful for those who aren't using Foreman to handle unattended installations but still use it to manage external nodes and handle reporting. As an example, this would allow one to add a host to Foreman as you are bootstrapping puppet on a new machine.
You would need to be able to pass basic parameters via REST: hostname/IP address, environment, Foreman group, etc.
Do you think this would be possible?
#1 Updated by Ohad Levy over 11 years ago
Foreman is already restful :)
there are a few other different usage cases where this would make sense - e.g. when I have many new machines to add and i don't want to key in each and every one of them.
it is possible to create new hosts already, you would only need to keep the cookie for authorization,
I'll post an example script in the extra sub directory.
another option for you which might be much easier is to use the host importer from an existing external nodes, this will allow you to create a simple yaml dump and feed it into foreman for new hosts.
see External Nodes
#2 Updated by Ohad Levy over 11 years ago
- Category set to Host creation
- Status changed from New to Resolved
- Assignee set to Ohad Levy
I've made a simple example of a script which creates hosts at http://gist.github.com/239561
If I'll have some more time, I'll clean it up and put it in the extra directory.