Troubleshooting Puppet Manifests for Windows puppet Node - puppet

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 :)

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.

Error while downloading JAR file from repo

I'm trying to download a JAR file from a repo, but I'm getting the below error:
pget { 'Download 123 jar file':
source => 'url'
target => 'C:\download,
targetfilename => '123.jar',
require => File['E:\download'],
}
I'm getting the below error while executing the resource
Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'pget'
Can anyone explain why I cannot use pget? Is there any other way to download the JAR file?
You either forgot to install the module that provides the pget type, or it was not installed correctly: https://forge.puppet.com/cyberious/pget
Install it either locally (using puppet apply) or on the master (using puppet agent) with:
puppet module install cyberious-pget
and then your resource will work.

git clone throws error with vcsrepo module puppet

I am following the pluralsight's tutorial for puppet fundamentals by Ben Piper.
When installing the "vcsrepo" module in agents and downloading the repository the puppet agent run hangs.
Below is the excerpt from my puppet master "init.pp" file
I changed my puppetmaster init.pp file to use the ssh instead.
`file { '/home/vagrant/.ssh/id_rsa':
ensure => 'present',
}
vcsrepo { '/var/www/html':
ensure => 'present',
provider => 'git',
source => 'git#github.com:wikimedia/mediawiki.git',
user => 'vagrant',
revision => 'REL1_23',
require => File['/home/vagrant/.ssh/id_rsa'],
}
file { '/var/www/html/index.html':
ensure => 'absent',
}
File['/var/www/html/index.html'] -> Vcsrepo['/var/www/html']`
It now throws the below error
Notice: /Stage[main]/Linux/File[/info.txt]/content: content changed '{md5}dd4735ab73567a89caba62c6607e44b5' to '{md5}e30fa7cc7448a09071a0e4d33efa5986'
Notice: /Stage[main]/Mediawiki/Vcsrepo[/var/www/html]/ensure: Creating repository from present
Error: Execution of 'git clone git#github.com:wikimedia/mediawiki.git /var/www/html' returned 1:
Error: /Stage[main]/Mediawiki/Vcsrepo[/var/www/html]/ensure: change from absent to present failed: Execution of 'git clone git#github.com:wikimedia/mediawiki.git /var/www/html' returned 1:
I have shared my system's public key in github account
On Linux
Execute the following in the command line before executing the Git command:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
On Windows
Execute the following in the command line before executing the Git command:
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
Cause
Error code 56 indicates a curl receive error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the clone process. Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
Workaround
Switch to using SSH to perform the clone.

How do I run a Puppet Manifest on a Windows server with Puppet Agent?

I have done it in the past. I don't know why I cannot do it this way below. I am using CentOS 7 for the Puppet Master server. I am using Windows Server 2012 with Puppet Agent.
All the content below was taken from the Puppet Master server. Here is site.pp (which is in /etc/puppet/manifests):
node 'fqdnOfWindowsServer' { import 'good.pp'}
node 'fqdnOfLinuxServer' {}
Here is good.pp (which is in /etc/puppet/manifests):
file { 'c:/fun.ps1':
ensure => 'present',
source => '/tmp/special.ps1',
source_permissions => 'ignore',
}
Here is what happens when I run puppet agent -t:
...Caching catalog for fqdnOfLinuxServer... Error: Failed to apply
catalog: Parameter path failed on File[c:/fun.ps1]: File paths must be
fully qualified, not 'c:/fun.ps1' at /etc/puppet/manifests/good.pp:5
How do I input a fully qualified path? It seems to be having a problem with a Windows server as the Puppet Agent. Paths are different from Linux Puppet Agents.
From what I can make of the error message, you're trying to create a Windows file resource on a Linux server (the error mentions caching catalog for fqdnOfLinuxServer). If that's the case, the error message makes sense because on Linux, the agent expects file paths to start with a forward slash.

Puppet ignores my node.pp entry

My Puppet master and agent are on the same machine. The master node.pp file contains this:
node 'pear.myserver.com' {
include ntp
}
The ntp.pp file contains this:
class ntp {
package { "ntp":
ensure => installed
}
service { "ntp":
ensure => running,
}
}
The /etc/hosts file contains the line:
96.124.119.41 pear.myserver.com pear
I was able to successfully launch puppetmaster, but when I execute this, ntp doesn't get installed (it is not installed already, I checked).
puppet agent --test --server='pear.myserver.com'
It just reports this:
info: Caching catalog for pear.myserver.com
info: Applying configuration version '1387782253'
notice: Finished catalog run in 0.01 seconds
I don't know what else I could have missed. Can you please help? Note that I replaced the actual server name with 'myserver' for security reasons.
I was following this tutorial: http://bitfieldconsulting.com/puppet-tutorial
$puppet agent --test
This will fetch compiled catalog from Master puppet, which is in /etc/puppetlabs/puppet/manifests/site.pp and run locally.
$puppet apply /etc/puppet/modules/ntp/manifests/ntp.pp
Will apply locally

Resources