Foreman discovery, use hooks and api to upload custom facts from CMDB

This is the workflow that i am trying with hooks and foreman discovery

VM/baremetal gets discovered -> after_create hook gets triggered -> Hook
use the discovery api to get more facts from discovered host -> facts are
used to gather more custom Facts from CMDB and they get uploaded to foreman.

It is important that i upload these facts from CMDB before provisioning
just after a node is discovered, since i use these facts in kickstart
template.

May i know, if the above is possible, using the below api?

PUT /api/v2/discovered_hosts/:id

I have tried to make it work, but it complains about architecture about
string. I am not sure, if the above api allows more custom facts to be
uploaded and would like to confirm the same.

What are the mandatory facts needed for the above api to work?

I would really appreciate if anyone could help me with above.

Thanks,
Lohit

I figured out this api, and its mandatory facts:

/api/v2/discovered_hosts/facts

I assumed, that it is only for creating new hosts.
I now understand that it is also to update or add custom facts if needed.

I think this should answer my question.

I will come back with a question, if i still face issues.

··· On Mon, Aug 28, 2017 at 11:04 PM, wrote:

This is the workflow that i am trying with hooks and foreman discovery

VM/baremetal gets discovered -> after_create hook gets triggered -> Hook
use the discovery api to get more facts from discovered host -> facts are
used to gather more custom Facts from CMDB and they get uploaded to foreman.

It is important that i upload these facts from CMDB before provisioning
just after a node is discovered, since i use these facts in kickstart
template.

May i know, if the above is possible, using the below api?

PUT /api/v2/discovered_hosts/:id

I have tried to make it work, but it complains about architecture about
string. I am not sure, if the above api allows more custom facts to be
uploaded and would like to confirm the same.

What are the mandatory facts needed for the above api to work?

I would really appreciate if anyone could help me with above.

Thanks,
Lohit


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/foreman-users/zG4hKvFBZD8/unsubscribe.
To unsubscribe from this group and all its topics, 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 https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.