Defined Type: hadoop::user
- Defined in:
- manifests/user.pp
Overview
Define hadoop::user
Create user account.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'manifests/user.pp', line 5
define hadoop::user(
$touchfile,
$shell,
$hdfs,
$groups = ['users'],
$homedir = "/home/${title}",
$realms = [],
) {
$username = $title
$usershell = $shell ? {
true => '/bin/bash',
false => '/bin/false',
}
$principals = prefix($realms, "${username}@")
group{$username:
ensure => 'present',
}
->
user{$username:
gid => $username,
groups => $groups,
managehome => $shell,
shell => $usershell,
}
if $shell and $realms and !empty($realms) {
file{"${homedir}/.k5login":
owner => $username,
group => $username,
mode => '0644',
content => join(suffix($principals, "\n"), ''),
require => User[$username],
}
}
if $hdfs {
hadoop::mkdir{"/user/${username}":
owner => $username,
group => 'hadoop',
mode => '0750',
touchfile => $touchfile,
}
}
}
|