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.
"require" does not do what you think it does -- it actually creates a dependency.
You want to use "include" instead in class capistranoDeps::config
For more information, also see this question:
What's the difference between include and require in puppet