Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)
I am getting error while executing puppet script on Puppet master site.pp file I wrote following code

node default {

class t {
package {'apache2':
ensure => installed,
}
}
}

-------------------
On Slave machine when i execute it
puppet agent --test
it throws the error 
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not parse for environment production: Classes, definitions, and nodes may only appear at toplevel or inside other classes (file: /etc/puppet/code/environments/production/manifests/site.pp, line: 3, column: 1) on node slave.ec2.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Can you please help me in this regard

1 Answer

0 votes
by (50.2k points)

Seems like you're mixing environment (agent is running under production environment, but your module is placed under development environment), copy your module under /etc/puppetlabs/code/environments/production/modules (as seen below) and test again.

cp -r /etc/puppetlabs/code/environments/development/modules/motd /etc/puppetlabs/code/environments/production/modules/

Related questions

0 votes
1 answer
+1 vote
1 answer
asked Mar 7, 2020 in DevOps and Agile by chandra (29.3k points)

Browse Categories

...