Add legacy hosts to Foreman to enable REX only?

We have a few super old Linux machines with Scientific Linux/Red Hat 5, SUSE 9, Ubuntu 12, openSUSE/SLES 11 that I would like to be able to use REX to. Is there a way to get these old machines manually “registered” in Foreman to a point where remote execution will work? I would like to avoid installing any new rpms on these EOL machines.

There are a couple of ways, possibly the cleanest (and the one which makes least assumptions about what you’re running), is just creating them as unmanaged hosts using hammer. Something like the following could work

h host create --managed false \
    --ip $ip \
    --name $name \
    --location 'Default Location' \
    --organization 'Default Organization'

You will need to deploy ssh keys to those hosts, but once you do that, you should be good to go.

Thanks, worked fine. I also had to set:
–hostgroup $hostgroup
–lifecycle-environment-id 1
–content-view-id 1
Since without them set, Foreman never used the correct proxy set by the host group to initiate REX, i just used the Foreman server.