I am trying to create a user with Puppet but everything I have been trying has failed.

I am trying to create a user named "capistrano" that will be placed in the "www-data" group. I have done the following configuration.

class capistranoDeps::user {
    user { "capistrano":
        ensure => present,
        comment => "Capistrano user",
        gid => 33,
        shell => "/bin/bash",
        require => Group["capistrano"],
    group {"capistrano":
        ensure => present,

class capistranoDeps::config {
    require capistranoDeps::user
    # Set permissions on webserver directories
    file {"/var/www/":
        ensure => directory,
        owner  => "capistrano",
        group  => "www-data",
        mode   => "775",
class capistranoDeps {
    require tools
    include capistranoDeps::user,capistranoDeps::config

When I try to execute this config on my host, I get the following error :

root@app1:/etc/openvpn# puppet agent --server=puppet.domain --no-daemonize --verbose
notice: Starting Puppet client version 2.6.2
info: Caching catalog for app1.domain
err: Could not run Puppet configuration client: Could not find user capistrano

The user has not already been created on the host as it is Puppet's job to do so. The examples I have found all over seem to be the same as this but since this isn't working, I am definitely missing something.

  • Never really used Puppet but the line 'user { "capistrano":' looks like you're trying to log in as the cap user, before it's been created, try changing that to a user that does exist and see what happens – Smudge Aug 16 '11 at 13:23
  • That is the line that's supposed to tell puppet to create it. – Antoine Benkemoun Aug 16 '11 at 13:28

"require" does not do what you think it does -- it actually creates a dependency.

You want to use "include" instead in class capistranoDeps::config

include capistranoDeps::user

For more information, also see this question:

What's the difference between include and require in puppet

  • Wow, that actually worked ! Thank you very much :) Puppet can be very strange sometimes but such an awesome piece of software ! – Antoine Benkemoun Aug 16 '11 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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