I'm just getting started with Puppet and I have the following code in my test site.pp file:
class { 'account': {
'danny':
home_dir => '/home/danny',
groups => [ 'sudo', 'users' ],
password => 'password'
}
}
I'm trying to use the account module from Puppet Forge. I have checked that the module is installed correctly.
The error given when using the above code is:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '{'; expected '}' at /etc/puppet/manifests/site.pp:12 on node testpuppet.domain.io Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run
Line 12 of site.pp is:
class { 'account': {
The documentation gives the following example:
account {
'sysadmin':
home_dir => '/opt/sysadmin',
groups => [ 'sudo', 'users' ],
ssh_key => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArfQmMkvtWRnwas3DIti9qAuSFQXKcE0kdp5f42PP8l2kTytJPPWp5T/q8PXDQ2d2X5KplMCMDiUQkchqhmDp840jsqBQ9iZPejAjv3w2kITgScFNymAcErtzX52iw4lnUyjZzomCW8G3YthQMaRm2NkI4wcVcjzq+SKyTfzrBoH21RgZlfcx+/50AFRrarpYqel9W5DuLmmShHxD8clPS532Z/1X+1jCW2KikUhdo98lxYTIgFno05lwFOS9Ry89UyBarn1Ecp1zXpIBE7dMQif3UyLUTU9zCVIoZiJj4iO5lemSSV0v8GL97qclBUVJpaCpc4ebR7bhi0nQ28RcxQ==',
comment => 'SysAdmin user',
}
all the other modules that I'm using are within a class, such as the NTP module:
class {
'::ntp':
servers => [
'0.uk.pool.ntp.org',
'1.uk.pool.ntp.org',
'2.uk.pool.ntp.org',
'3.uk.pool.ntp.org'
],
}
What would the correct syntax be to use the account module?
You can name your classes as you want, but you need to use the right name for resources. In this case, the resource you want to use is
user
.There is a very simple way to know how a resource should look:
That code, inside a class would look:
Puppetlabs have a very good documentation on the resource abstraction layer, RAL for short.
I'm no puppet whiz, but you have an unmatched
{
in your sample. You have one open brace forclass
and another foraccount
, but you only ever close the account brace.