Add existing host to foreman

Hello,

I am starting to test Foreman to help with some Ubuntu Desktops (16.04)
in a FreeIPA realm.

Most docs around focus on installing new hosts.

What is the best way for pre-existing hosts?

Right now, it seems to be this steps:

i.   install puppet.

ii.  in puppet.conf, remove the [main] section and point a
[agent]/server to the Foreman host.

iii. restart the daemon.

iv.  enable the agent (puppet agent --enable).

v.   sign the certificate on Foreman (puppet cert sign fqhn).
      I will try to integrate with FreeIPA PKI later on.

vi.  test the agent (puppet agent --test).

Is this all needed steps? Or there is a foreman specific way?

Thanks,

-rsd

1 Like

I have the same problem. In my case, the short domain “puppet” is an alias for my foreman server (which is also my puppet server), so just steps i. and vi. were necessary. After investigation, I see that the host is created in foreman at the very last step of the puppet run, where apparently it reports facts back to foreman. From the foreman api documentation, I see the following:

POST /api/hosts/facts

Upload facts for a host, creating the host if required

So, I think that you could potentially skip running puppet and just POST to that endpoint. However, I haven’t gotten it to work.