Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get puppet to assign authorized ssh keys for virtual users but I keep getting the following error:

err: Could not retrieve catalog: Could not parse for environment production: Syntax error at 'user'; expected '}' at /etc/puppet/modules/users/manifests/ssh_authorized_keys.pp:9

I believe my configuration are correct (listed below) but is there a syntax error or scoping issue I am missing? I would simply like to assign users to nodes and have those users automagically have their ssh keys installed. Is there maybe a better way to do this and I'm just overthinking it?

# /etc/puppet/modules/users/virtual.pp

class user::virtual {
  @user { "user":
    home => "/home/user",
        ensure => "present",
        groups => ["root","wheel"],
        uid => "8001",
        password => "SCRAMBLED",
        comment => "User",
        shell => "/bin/bash",
    managehome => "true",

# /etc/puppet/modules/users/manifests/ssh_authorized_keys.pp

ssh_authorized_key { "user":
  ensure => "present",
  type => "ssh-dss",
  key => "AAAAB....",
  user => "user",

# /etc/puppet/modules/users/init.pp

import "users.pp"
import "ssh_authorized_keys.pp"

class user::ops inherits user::virtual {

# /etc/puppet/manifests/modules.pp

import "sudo"
import "users"

# /etc/puppet/manifests/nodes.pp

node basenode {
  include sudo

node 'testbox' inherits basenode {
  include user::ops 

# /etc/puppet/manifests/site.pp

import "modules"
import "nodes"

# The filebucket option allows for file backups to the server
filebucket { main: server => 'puppet' }

# Set global defaults - including backing up all files to the main filebucket and adds a global path
File { backup => main }
Exec { path => "/usr/bin:/usr/sbin/:/bin:/sbin" }
share|improve this question

You're missing a closing brace at the end of virtual.pp.

share|improve this answer

Here's a puppet module I wrote a year ago for managing users for a previous employer.

share|improve this answer
This looks so complicated... – SamK Nov 16 '11 at 9:01
It was the simplest thing that I came up with that worked. Everywhere I asked for help or other approaches I was told "use LDAP", which was a non-answer for only 10 users, since we didn't use LDAP anywhere else, and had to support 3 physical sites. – jtimberman Nov 20 '11 at 1:43

Yes there is a better way, this is exactly what definitions are for. You would create a definition called something like "ssh_user", make virtual users of that type, then realize those. Josh's code makes use of a define like I am talking about, but you would also add the ssh_authorized_key in the define, parameterized with variables from the define.

share|improve this answer

I highly recommend using Puppet syntax highlighting to avoid this sort of thing.

share|improve this answer
And have a look at Geppetto, a nice toolset to help develop Puppet modules and manifests. It would signal an error like this. – Martijn Heemels May 29 '11 at 22:43
It's Eclipse-based. I wouldn't call that "nice" :p – ThiefMaster Mar 10 '14 at 10:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.