How to enable site.pp in Puppet server? - puppet

It displays:
Error: Could not parse application options: invalid option: /etc/puppet/manifests/test.pp
When I sent a file from server to client in puppet 3.8.4. How to fix it?

Related

Puppet7 agent can't find catalog from server

I'm learning Puppet now. Everything is new to me... After installed a puppet7 server and agent on my two learning VMs--
192.168.160.131 puppet-mst.eisen #The puppet server
192.168.160.140 sles12.eisen #The puppet agent
And I've successfully signed the node "sles12.eisen" to the server "puppet-mst.eisen" --
[root#puppet-mst manifests]# puppetserver --version
puppetserver version: 7.4.1
[root#puppet-mst manifests]# puppetserver ca list --all
Signed Certificates:
puppet-mst.eisen (SHA256) 0B:3F:DA:60:2F:2D:D3:91:94:58:E2:B6:32:28:50:8E:D4:1C:A0:8F:A0:CF:94:99:6E:EE:99:46:B4:1D:30:58 alt names: ["DNS:puppet-mst.eisen"] authorization extensions: [pp_cli_auth: true]
puppet-mst (SHA256) C8:89:47:D2:15:74:6E:49:E7:9A:27:B5:EA:10:9B:81:C4:DC:68:E8:B4:01:07:5D:63:34:5A:AF:B6:66:C9:EE alt names: ["DNS:puppet-mst"]
sles12.eisen (SHA256) C5:40:D7:8A:C6:64:BD:E8:BF:D3:BB:5D:01:24:66:03:57:96:84:31:84:42:DF:36:AA:D1:25:14:76:4D:A5:99 alt names: ["DNS:sles12.eisen"]
Then I wrote a testing module --filetest1, and hope it can put a file to the agent node in /tmp/puppettest --
[root#puppet-mst manifests]# cat /etc/puppetlabs/code/environments/production/modules/filetest1/manifests/init.pp
class filetest1{
file {'/tmp/puppettest/filetest1':
ensure => file,
content => 'Hello World!',
}
}
[root#puppet-mst manifests]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
node 'sles12.eisen'{
include filetest1
}
But the "puppet agent --test" can't work, it's said it either server can't find agent node, or the test module's catalog is missing --
sles12:/tmp/puppettest # puppet --version
7.12.0
sles12:/tmp/puppettest # hostname -f
sles12.eisen
sles12:/tmp/puppettest # puppet agent --test --verbose
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Failed when searching for node sles12.eisen: Failed to find sles12.eisen via exec: Execution of '/etc/puppetlabs/puppet/node.rb sles12.eisen' returned 1:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
I don't know what's wrong here. Please kind help. Thanks
Regards
Eisen
The error message suggests that you have configured Puppet to use an external node classifier (/etc/puppetlabs/puppet/node.rb), and either the attempt to execute it is failing altogether, or it is terminating with a failure status, or it is not outputting anything.
You may want to explore ENCs later, but now is probably not the time for that. To disable use of an ENC, edit /etc/puppetlabs/puppet/puppet.conf and either remove the node_terminus setting or change its value to plain.

puppet Forbidden request /puppet-ca/v1/certificate/ca

I'm not able to make a puppet node join a master, i'm using puppet enterprise on AWS cloud.
Master
puppetserver --version
puppetserver version: 2017.3.0.38
Node
# puppet agent --test
Error: Could not request certificate: Error 403 on SERVER: Forbidden request: /puppet-ca/v1/certificate/ca (method :get). Please see the server logs for details.
Exiting; failed to retrieve certificate and waitforcert is disabled
obviously error message is related to permission on master side, when i check the log on the master i see
ERROR [qtp2147089302-255] [p.t.a.rules] Forbidden request: 10.0.10.224 access to /puppet-ca/v1/certificate/ca (method :get) (authenticated: false) denied by rule 'puppetlabs certificate'.
but i checked that the new HOCON format for auth.conf is allowing un authenticated node to send CSR
{
"allow-unauthenticated": "*",
"match-request": {
"method": "get",
"path": "/puppet-ca/v1/certificate/",
"query-params": {},
"type": "path"
},
"name": "puppetlabs certificate",
"sort-order": 500
}
i checked also that pe-puppet-server.conf is not using the legacy auth.conf method
# (optional) Authorize access to Puppet master endpoints via rules specified
# in the legacy Puppet auth.conf file (if true or not specified) or via rules
# specified in the Puppet Server HOCON-formatted auth.conf (if false).
use-legacy-auth-conf: false
max-active-instances: 2
max-requests-per-instance: 0
environment-class-cache-enabled: true
please advise, the same error msg occurs on both windows and linux
i did reboot the entire server(ec2 instance) since reloading puppetserver didn't help ... i also did the auth change from the console, as structed here
windows Puppet agent does not connect to the awsopsworks puppet Enterprise master
I had a similar issue when trying to setup my puppet nodes, but was using Vagrant instead of AWS.
The fix was to unset the following environment variables: http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY.
My fix was to remove server_list from puppet.conf, cleanup CM cert and re-generate cert. In my case I have autosign=true so the process was:
Stop PE on CM:
systemctl stop puppet pxp-agent pe-puppetserver pe-puppetdb
Remove ssl dir
rm -fr /etc/puppetlabs/puppet/ssl
Cleanup cert from Primary:
puppetserver ca clean --certname='<CM>'
Run puppet agent on CM
puppet agent -t
Done.

Troubleshooting Puppet Manifests for Windows puppet Node

I have puppet manifests which would download exe file and get installed in windows server.I am getting an error while running command: puppet agent -t on windows server.
Manifests file: /etc/puppet/modules/mercury/manifests/iisserver.pp
class mercury::iisserver {
download_file { "Download dotnet core 2":
url => 'http://download.microsoft.com/download/7/3/A/73A3E4DC-F019-47D1-9951-0453676E059B/dotnet-sdk-2.0.2-win-gs-x64.exe',
destination_directory => 'C:/dotnet-sdk-2.0.2-win-gs-x64.ex',
notify => Package["dotnercore2"],
}
package { "dotnercore2":
ensure => installed,
source => "C:/dotnet-sdk-2.0.2-win-gs-x64.exe",
require => File["C:/dotnet-sdk-2.0.2-win-gs-x64.exe"],
}
}
Error on windows server after running Puppet agent -t:
Error :Could not retreive catalog from remote server:error 400 on server:Syntax error at 'Stdlib::HTTPUrl'; Expected')' at /etc/puppet/modules/download_file/manifests/init.pp on node XXXX
Warning : not using cache on failed catalog.
Error: Could not retrieve catalog; Skipping run
If you look closely, your error output shows what is wrong. There is a Syntax error with your HTTPUrl on your /etc/puppet/modules/download_file/manifests/init.pp file. It is expecting a ')' character somewhere. Could you recheck your manifest for the download_file module or post it here so that we can review :)

Puppet Could not find declared class

I'm seeing the following error on puppet agent run:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class ::nagios::server at /etc/puppetlabs/code/environments/production/site/role/manifests/nagios.pp:2:2 on node mynode.something.co.uk
i have a nagios module which has a server manifest
The issue was with metadata.json file, when I ran:
puppet config print modulepath --section master --environment production
I got the message:
Error: No dependencies module metadata provided for nagios
So I added empty array to metadata.json:
"dependencies": []

puppet apply error: Could not find default node or by name with 'uys0115' on node uys0115

I have installed puppet on two nodes, and the server node hostname is "uys0115", and the cient node hostname is "uys0119", and the server node have siged the client node. When I exec the commad: puppet cert list --all, we can see:
+ "uys0115" (24:55:95:77:8E:60:33:77:C8:D4:74:EA:01:21:BD:5A)
+ "uys0119" (86:53:1B:81:E5:4F:88:23:E8:34:E1:AB:03:D4:AE:7C)
The puppet main directory is /etc/puppet/, I have write an example and the organization of files as follows:
/etc/puppet/--
|-/manifests/site.pp
|-/modules/test/--
|-/files/text.txt
|-/manifests/init.pp
|-/manifests/test.pp
The code in /etc/puppet/modules/test/manifests/test.pp is:
class test1 {
package { "bison":
ensure=>"installed",
}
exec { "puppet test":
command=>"/bin/touch /tmp/puppet-test",
}
file { "/tmp/test.txt":
ensure => "present",
source => "puppet:///modules/test/test.txt"
}
}
and the code in /etc/puppet/modules/test/manifests/init.pp is just import "*";
and the code in /etc/puppet/manifests/site.pp as follows:
import "test"
node default {
include "test1"
}
When I in the client node uys0119 and exec the command puppet agent --test --server uys0115.
It executed successfully and created two files puppet-test and test.txt in the directory /tmp/.
In the server node when I exec the command puppet apply site.pp, it also executed successfully and created two files. However, the terminal out put two warning messages:
warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
When I changed the code in /etc/puppet/manifests/site.pp as follows:
import "test"
node "uys0119" {
include "test1"
}
and exec the command puppet apply site.pp in the server node, it failed an output the error messages:
warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: uys0115
warning: Host is missing hostname and/or domain: uys0115
Could not find default node or by name with 'uys0115' on node uys0115
But the client node can sucessfully exec the command puppet agent --test --server uys0115 too. Can anybody explain that?
If I want to the server node send some repuests to the client nodes and drive some client nodes responses the server and procduces results. How can I do when uses puppet? Can somebody give me an example? thanks very much!!!
The server puppet serves as both puppet master and puppet node.
When you edited site.pp as below:
import "test"
node default {
include "test1"
}
all puppet nodes connect to puppet master will do operations defined in class "test1". So you found two files in both uys0115 and uys0119(treat as a puppet node).
When changed your site.pp to the following:
import "test"
node "uys0119" {
include "test1"
}
puppet node uys0115 can not find its definition in site.pp (because it only defines uys0119) and puppet master output error info like this:
Could not find default node or by name with 'uys0115' on node uys0115
Here is a modified site.pp can eliminate this error:
import "test"
node "uys0119" {
include "test1"
}
node "uys0115" {
include "test1"
}
In puppet master/slave mode, you'd better use fqdn such as uys0115.localdomain, then the following warning will not show
warning: Host is missing hostname and/or domain: uys0115

Resources