Cannot register foreman host to foreman database‏

Dear Colleagues,

I have installed foreman in centos 7.1 with external postgresql database
and now when i try to register foreman host to foreman database using the
command:
puppet agent --test

i get this error:

Warning: Unable to fetch my node definition, but the agent run will
continue:
Warning: Error 400 on SERVER: Failed to find tvim-ms-lcms.npp38.tcs via
exec: Execution of '/etc/puppet/node.rb tvim-ms-lcms.npp38.tcs' returned 1:
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed when searching for node tvim-ms-lcms.npp38.tcs: Failed to find
tvim-ms-lcms.npp38.tcs via exec: Execution of '/etc/puppet/node.rb
tvim-ms-lcms.npp38.tcs' returned 1:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The output of the command:
[puppet@tvim-ms-lcms ~]$ /etc/puppet/node.rb tvim-ms-lcms.npp38.tcs

Error retrieving node tvim-ms-lcms.npp38.tcs: Net::HTTPForbidden
Check Foreman's /var/log/foreman/production.log for more information.

The content of /var/log/foreman/production.log:-

/var/log/foreman/production.log

Started GET "/node/tvim-ms-lcms.npp38.tcs?format=yml" for 172.22.51.51 at 2016-04-25 09:55:51 +0300
2016-04-25 09:55:51 [I] Processing by HostsController#externalNodes as YML
2016-04-25 09:55:51 [I] Parameters: {"name"=>"tvim-ms-lcms.npp38.tcs"}
2016-04-25 09:55:51 [W] No smart proxy server found on ["tvim-ms-lcms.npp38.tcs"] and is not in trusted_puppetmaster_hosts
2016-04-25 09:55:51 [I] Redirected to https://tvim-ms-lcms.npp38.tcs/users/login
2016-04-25 09:55:51 [I] Filter chain halted as #<Proc:0x0000000a11f530@/usr/share/foreman/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb:15> rendered or redirected
2016-04-25 09:55:51 [I] Completed 403 Forbidden in 4ms (ActiveRecord: 0.9ms)
2016-04-25 09:55:51 [I]

Started POST "/api/reports" for 172.22.51.51 at 2016-04-25 09:55:51 +0300
2016-04-25 09:55:51 [I] Processing by Api::V2::ReportsController#create as JSON
2016-04-25 09:55:51 [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2016-04-25 09:55:51 [W] No smart proxy server found on ["tvim-ms-lcms.npp38.tcs"] and is not in trusted_puppetmaster_hosts
2016-04-25 09:55:51 [I] Rendered api/v2/errors/access_denied.json.rabl within api/v2/layouts/error_layout (0.6ms)
2016-04-25 09:55:51 [I] Filter chain halted as #<Proc:0x00000009d74b10@/usr/share/foreman/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb:15> rendered or redirected
2016-04-25 09:55:51 [I] Completed 403 Forbidden in 11ms (Views: 2.0ms | ActiveRecord: 1.6ms)

Also foreman, puppet and the external postgres database are installed in
the same host. Please be informed that i disabled selinux and firewalld for
test. Also i can ping tvim-ms-lcms.npp38.tcs without problems.

Please give me your support to solve this problem.

Best Regards,

The problem is solved by configuring smart proxy in foreman

··· On Monday, April 25, 2016 at 10:54:37 AM UTC+3, nilelinux wrote: > > Dear Colleagues, > > I have installed foreman in centos 7.1 with external postgresql database > and now when i try to register foreman host to foreman database using the > command: > puppet agent --test > > i get this error: > > Warning: Unable to fetch my node definition, but the agent run will > continue: > Warning: Error 400 on SERVER: Failed to find tvim-ms-lcms.npp38.tcs via > exec: Execution of '/etc/puppet/node.rb tvim-ms-lcms.npp38.tcs' returned 1: > Info: Retrieving pluginfacts > Info: Retrieving plugin > Error: Could not retrieve catalog from remote server: Error 400 on SERVER: > Failed when searching for node tvim-ms-lcms.npp38.tcs: Failed to find > tvim-ms-lcms.npp38.tcs via exec: Execution of '/etc/puppet/node.rb > tvim-ms-lcms.npp38.tcs' returned 1: > Warning: Not using cache on failed catalog > Error: Could not retrieve catalog; skipping run > > The output of the command: > [puppet@tvim-ms-lcms ~]$ /etc/puppet/node.rb tvim-ms-lcms.npp38.tcs > > Error retrieving node tvim-ms-lcms.npp38.tcs: Net::HTTPForbidden > Check Foreman's /var/log/foreman/production.log for more information. > > The content of /var/log/foreman/production.log:- > > /var/log/foreman/production.log > > Started GET "/node/tvim-ms-lcms.npp38.tcs?format=yml" for 172.22.51.51 at 2016-04-25 09:55:51 +0300 > 2016-04-25 09:55:51 [I] Processing by HostsController#externalNodes as YML > 2016-04-25 09:55:51 [I] Parameters: {"name"=>"tvim-ms-lcms.npp38.tcs"} > 2016-04-25 09:55:51 [W] No smart proxy server found on ["tvim-ms-lcms.npp38.tcs"] and is not in trusted_puppetmaster_hosts > 2016-04-25 09:55:51 [I] Redirected to https://tvim-ms-lcms.npp38.tcs/users/login > 2016-04-25 09:55:51 [I] Filter chain halted as # rendered or redirected > 2016-04-25 09:55:51 [I] Completed 403 Forbidden in 4ms (ActiveRecord: 0.9ms) > 2016-04-25 09:55:51 [I] > > Started POST "/api/reports" for 172.22.51.51 at 2016-04-25 09:55:51 +0300 > 2016-04-25 09:55:51 [I] Processing by Api::V2::ReportsController#create as JSON > 2016-04-25 09:55:51 [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"} > 2016-04-25 09:55:51 [W] No smart proxy server found on ["tvim-ms-lcms.npp38.tcs"] and is not in trusted_puppetmaster_hosts > 2016-04-25 09:55:51 [I] Rendered api/v2/errors/access_denied.json.rabl within api/v2/layouts/error_layout (0.6ms) > 2016-04-25 09:55:51 [I] Filter chain halted as # rendered or redirected > 2016-04-25 09:55:51 [I] Completed 403 Forbidden in 11ms (Views: 2.0ms | ActiveRecord: 1.6ms) > > > Also foreman, puppet and the external postgres database are installed in > the same host. Please be informed that i disabled selinux and firewalld for > test. Also i can ping tvim-ms-lcms.npp38.tcs without problems. > > Please give me your support to solve this problem. > > > *Best Regards,* >