Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 –  sam 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
add comment

1 Answer

up vote 2 down vote accepted

"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

share|improve this answer
    
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
add comment

Your Answer

 
discard

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.