Provision hosts using restful API

Hi,

I have setup foreman and enabled the auto discovery plugin. When I network boot nodes they appear in the 'Discovered Hosts' group and I can manually provision them.

Is it possible to use the restful API to automatically provision hosts? I had a look through the API and couldn't find any methods, but hopefully I missed something?

My intention is to automatically provision a large group of machines (20-30) and automatically configure them for different roles and start the process, without having to click the provision button for each individual host.

Cheers

Dave Johnston

Hi Dave,

If you're ok with using python you might want to take a look to the
foreman-host-builder script that we're using on top of the python-foreman
wrapper:

Cheers,

Xavier

··· On Wed, Oct 8, 2014 at 8:30 AM, Dave Johnston wrote:

Hi,

I have setup foreman and enabled the auto discovery plugin. When I
network boot nodes they appear in the ‘Discovered Hosts’ group and I can
manually provision them.

Is it possible to use the restful API to automatically provision hosts?
I had a look through the API and couldn’t find any methods, but hopefully I
missed something?

My intention is to automatically provision a large group of machines
(20-30) and automatically configure them for different roles and start the
process, without having to click the provision button for each individual
host.

Cheers

Dave Johnston


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

I think foreman_discovery 1.3 and higher has an API which you could use.

Try hitting /api/v2/discovered_hosts to pull back a list, and then if
you PUT to /api/v2/discovered_hosts/$ID then it should provision it.

There's a list of parameters here:

But in theory it should also show up in /apidoc/ on the server, but it
doesn't seem to work here.

··· On 08/10/14 07:30, Dave Johnston wrote: > Hi, > > > I have setup foreman and enabled the auto discovery plugin. When I > network boot nodes they appear in the 'Discovered Hosts' group and I can > manually provision them. > > > Is it possible to use the restful API to automatically provision hosts? > I had a look through the API and couldn't find any methods, but > hopefully I missed something?


Dominic Cleal
Red Hat Engineering