Foreman/Puppet ENC problem

HI everyone,

We encount a problem with Foreman/Puppet integration.

Two nodes, one for foreman, and one for puppet.
We add a proxy and enable them in foremam-proxy configuration.
We see the service puppet/puppetca/facts in Foreman > Smart-proxy page.
Reports are now available in Foreman.

But if we go on the host page in Foreman, then "yaml" section, we don't see
the real information about the host. puppmaster and other informations are
empty…
If we do the same thing in CLI "sudo -u puppet /etc/puppet/node.rb
hostname.domain.local", the output is the same.
But for some host, all infomations are available. No difference between
host, same network, same configuration…

I add these lines into [master] in /etc/puppet/puppet.conf

external_nodes = /etc/puppet/node.rb
node_terminus = exec

Then I restart the puppet master.

And now, no one node, even the puppet server, can use puppet.
An error is display:Warning: Unable to fetch my node definition, but the
agent run will continue:

Warning: Error 400 on SERVER: Failed to find hostname.domain.local via exec:
Execution of '/etc/puppet/node.rb hostname.domain.local' returned 127:
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed when searching for node hostname.domain.local: Failed to find
hostname.domain.local via exec: Execution of '/etc/puppet/node.rb
hostname.domain.local' returned 127:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I don know why, and can't find a solution. If I comment the two line in
puppet.conf and restart master service, it works again.

Do you have an idea ?

The exit code here is unusual, it suggests the script isn't being run
and either can't be found or can't be executed (it's a typical shell
exit code).

a) double check the script path
b) check that the script is executable
c) if SELinux is enforcing, try permissive and/or check for AVCs
d) check if /etc is on a noexec mountpoint
etc.

It's probably not an issue inside the script with that exit code.

··· On 08/12/15 16:00, Fabien Morcamp wrote: > I add these lines into [master] in /etc/puppet/puppet.conf > > > > external_nodes =/etc/puppet/node.rb > node_terminus =exec > > > > Then I restart the puppet master. > > And now, no one node, even the puppet server, can use puppet. > An error is display:Warning: Unable to fetch my node definition, but the > agent run will continue: > > > > Warning:Error400on SERVER:Failedto find hostname.domain.localvia > exec:Executionof '/etc/puppet/node.rb hostname.domain.local'returned 127: > Info:Retrievingpluginfacts > Info:Retrievingplugin > Info:Loadingfacts > Error:Couldnotretrieve catalog fromremote server:Error400on > SERVER:Failedwhensearching fornode hostname.domain.local:Failedto find > hostname.domain.localvia exec:Executionof '/etc/puppet/node.rb > hostname.domain.local'returned 127:


Dominic Cleal
dominic@cleal.org

Hi Dominic,

Thanks for your help.

I check the script path, and it's ok. I try to put it another folder with
less permissions, but the problems still present.
The file permissions are 755. I try to change the owner to 'puppet' user,
but no changes.
SElinux is disabled for now.
The file is locate in folder where noexec is not activate.

But it works now. I find why…
My puppet user have his default environment to /sbin/nologin.
If I change it to /bin/bash, it can now execute the script…

Thanks again for your help, you give me the way why the script can't be
executed!

Have a nice day

··· On Wednesday, December 9, 2015 at 3:19:04 AM UTC-5, Dominic Cleal wrote: > > On 08/12/15 16:00, Fabien Morcamp wrote: > > I add these lines into [master] in /etc/puppet/puppet.conf > > > > > > > external_nodes =/etc/puppet/node.rb > > node_terminus =exec > > > > > > > Then I restart the puppet master. > > > > And now, no one node, even the puppet server, can use puppet. > > An error is display:Warning: Unable to fetch my node definition, but the > > agent run will continue: > > > > > > > Warning:Error400on SERVER:Failedto find hostname.domain.localvia > > exec:Executionof '/etc/puppet/node.rb hostname.domain.local'returned > 127: > > Info:Retrievingpluginfacts > > Info:Retrievingplugin > > Info:Loadingfacts > > Error:Couldnotretrieve catalog fromremote server:Error400on > > SERVER:Failedwhensearching fornode hostname.domain.local:Failedto find > > hostname.domain.localvia exec:Executionof '/etc/puppet/node.rb > > hostname.domain.local'returned 127: > > The exit code here is unusual, it suggests the script isn't being run > and either can't be found or can't be executed (it's a typical shell > exit code). > > a) double check the script path > b) check that the script is executable > c) if SELinux is enforcing, try permissive and/or check for AVCs > d) check if /etc is on a noexec mountpoint > etc. > > It's probably not an issue inside the script with that exit code. > > -- > Dominic Cleal > dom...@cleal.org >