We are using Foreman to provision a server which it does successfully however when running puppet agent -t on the provisioned server the puppet agent shows the following error.
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 500 on SERVER: Server Error: Failed to find server.domain.com via exec: Execution of ’ /etc/puppetlabs/puppet/node.rb server.domain.com’ returned 1:
Info: Retrieving pluginfacts
Info Retrieving plugin
Info: Retrieving locales
Info: Loading Facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Failed when searching for node server.domain.com: Failed to find server.domain.com via exec: Execution of ‘/etc/puppetlabs/puppet/node.rb server.domain.com’ returned 1:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
The server.domain.com.yaml is saved properly in the /opt/puppetlabs/server/data/puppetserver/yaml/facts but it does not appear in /opt/puppetlabs/server/data/puppetserver/yaml/foreman
When we manually copy another .yaml that is in the /opt/puppetlabs/server/data/puppetserver/yaml/foreman folder and change the server name etc. then the agent can connect and can run the puppet agent -t
We would like the puppet agent -t to pass without having to manually create a .yaml file in the foreman folder. We have confirmed that :puppetdir in /etc/puppetlabs/puppet/foreman.yaml is set to “/opt/puppetlabs/server/data/puppetserver”
The certificat is also successfully automatically approved and appears in both the server and agent.
Puppet Agent:
Foreman and Proxy versions:
Puppet Agent Version: 5.4.0
Puppet Master Version: I am not sure
Foreman Version: 1.18.2