I'm having the issue with the passwd::user accepting the schedule metaparameter. I have tried it both with and without define the variable 'schedule.'
class passwd (
$module_path = $passwd::params::module_path,
$path = $passwd::params::path,
$alg = $passwd::params::alg,
$length = $passwd::params::length,
$plugin = $passwd::params::plugin,
$enotify = $passwd::params::enotify,
$esubject = $passwd::params::esubject,
$schedule = $passwd::params::schedule,
$managehome = $passwd::params::managehome,
$homeowner_override = $passwd::params::homeowner_override,
$homeowner = $passwd::params::homeowner,
$homegroup = $passwd::params::homegroup,
$users = [],
) inherits passwd::params {
include passwd::virtual
validate_absolute_path($module_path)
validate_absolute_path($path)
validate_string($alg)
validate_array($enotify)
validate_string($esubject)
validate_array($users)
validate_bool($managehome)
validate_bool($homeowner_override)
anchor {'passwd::begin': } ->
class {'passwd::install': } ->
class {'passwd::schedule': } ->
class {'passwd::provision': } ->
anchor {'passwd::end': }
}
define passwd::user (
$password,
$uid,
$gid,
$comment,
$shell,
$home = "${passwd::home_root}/${name}",
$managehome = $passwd::managehome,
$homeowner_override = $passwd::homeowner_override,
$homeowner = $passwd::homeowner,
$homegroup = $passwd::homegroup,
$path = $passwd::path,
$length = $passwd::length,
$ensure = $passwd::ensure,
$plugin = $passwd::plugin,
$enotify = $passwd::enotify,
$esubject = $passwd::esubject,
$schedule = undef
){
if ($password == 'G' and $ensure == 'present') {
$pclear = generate('/bin/sh','-c',"/bin/cat /dev/urandom | /usr/bin/tr -dc 'a-zA-Z0-9' | /usr/bin/fold -w ${length} | /usr/bin/head -n 1| tr -d '\n'")
$pcrypt = generate('/usr/bin/openssl','passwd','-1',"'${pclear}'")
$rpassword = chomp("${pcrypt}")
notify {"${rpassword}":}
if ! empty($enotify) {
passwd::notify { $name:
enotify => $enotify,
username => $name,
password => $pclear
}
}
}
else {
$rpassword = $password
}
Augeas {
load_path => "${passwd::params::module_path}/auglenses",
lens => "PluginPasswd.lns",
incl => "${path}",
}
case $ensure {
present: {
augeas { "pw_pl_mod_${name}":
changes => [
"set ${name}/password '${rpassword}'",
"set ${name}/uid '${uid}'",
"set ${name}/gid '${gid}'",
"set ${name}/name '${comment}'",
"set ${name}/home '${home}'",
"set ${name}/shell '${shell}'",
],
schedule => $schedule
}
if $managehome {
file { $home:
ensure => directory,
owner => homeowner_override ? {
true => $homeowner,
default => $uid
},
group => homeowner_override ? {
true => $homeowner,
default => $gid
},
seltype => user_home_dir_t,
require => File[$passwd::home_root]
}
}
}
absent: {
augeas { "pw_pl_mod_${name}":
changes => [
"rm ${name}"
]
}
}
}
}
class passwd::schedule (
) inherits passwd {
schedule { 'passwd_generate_monthly':
period => monthly,
range => "2 - 4",
repeat => 1
}
}
When I call passwd::user as either a resource or virtual resource, schedule is only honored by puppets built in functions within my define, but not by passwd::user.
class passwd::virtual(
) inherits passwd {
passwd::user{ 'johnjackson':
password => "supersecretpassword",
uid => 121,
gid => 121,
comment => "User Comment",
shell => "/bin/false",
schedule => 'passwd_generate_monthly'
}
@passwd::user{ 'jimbeam':
password => "G",
uid => 121,
gid => 121,
comment => "User Comment",
shell => "/bin/false",
schedule => 'passwd_generate_monthly',
}
}
Thanks!
M