I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
Rails keep an authentication (cross site scripting) headers, so you will
need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical id
representation, might need to fetch the html to know the right text values
(which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you to
create the machines directly, but I agree that the restful API is probably
better on the long run.
let me know if you need any help,
Ohad
···
On Fri, Jun 4, 2010 at 1:11 AM, Gus wrote:
Hi All!
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
a little play around with the api, created a simple machanize based
solution:
you could extend this to query and set the right values.
cheers,
Ohad
···
On Fri, Jun 4, 2010 at 10:02 AM, Ohad Levy wrote:
Hi Gus,
Foreman does support restful API.
there are a couple of things to notice:
Rails keep an authentication (cross site scripting) headers, so you will
need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical id
representation, might need to fetch the html to know the right text values
(which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you to
create the machines directly, but I agree that the restful API is probably
better on the long run.
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
Rails keep an authentication (cross site scripting) headers, so you
will need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical id
representation, might need to fetch the html to know the right text values
(which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you to
create the machines directly, but I agree that the restful API is probably
better on the long run.
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
Rails keep an authentication (cross site scripting) headers, so you
will need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical id
representation, might need to fetch the html to know the right text values
(which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you to
create the machines directly, but I agree that the restful API is probably
better on the long run.
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
Rails keep an authentication (cross site scripting) headers, so you
will need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical
id representation, might need to fetch the html to know the right text
values (which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you to
create the machines directly, but I agree that the restful API is probably
better on the long run.
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…
I have already tried this. It seems that mechanize validates the form before
posting the data. This is why I need to clink add parameter link to retrieve
the new form fields.
To solve this, I have done exacty what your last gist suggest, but without
using mechanize…
If I set Content-Type header to application/json, rails ignores the
authtencitity token, making things a little bit easier…
Cheers,
Gus
···
On Wed, Jun 16, 2010 at 2:10 AM, Ohad Levy wrote:
Hi Gus,
just updated the gist to include a second parameter.
Rails keep an authentication (cross site scripting) headers, so you
will need to use those (see an example here: http://gist.github.com/239561)
All values which are in dropdown boxes, are usually plain numerical
id representation, might need to fetch the html to know the right text
values (which fit to the numerical ids).
another option is to use the script/runner in rails, which allows you
to create the machines directly, but I agree that the restful API is
probably better on the long run.
I am looking for a way to automate virtual machine provisioning with
puppet.
For this, I am considering to use foreman external node capability to
keep the specification off all nodes known to puppet.
My question is, is there an automated way to insert or alter a host in
foreman data model without using the web interface… such as a Restful
API for instance…