I am new to Foreman and finally get the foreman and smart proxy doing it’s thing. However, I would like to add a bit of automation so that registering existing hosts to Foreman can be auto.
I know that there is a way to generate a code to register a host to specific content view in GUI. but is there any way I can write an ansible playbook to generate that token and then execute in the ansible host/inventory so that they are registered to Foreman content view without going to GUI?
Unfortunately, I am facing this error when I tried to run the collection to register the host. Is there anything that I should enable in the foreman server so that it will accept an ansible code to run outside of it?
Max retries exceeded with url: /apidoc/v2.json (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7fcec6df6310>: Failed to establish a new connection: [Errno -2] Name or service not known’
Thanks @evgeni . My bad. I figured it out. the above error that I have encountered was because the target host doesn’t have the foreman server host entry defined in /etc/hosts… The the forman registration collection works great!