add users creation
This commit is contained in:
parent
33853a0ea6
commit
1200d3528a
1 changed files with 24 additions and 1 deletions
|
@ -51,6 +51,9 @@
|
|||
# [*vapid_public_key*]
|
||||
# String with VAPID public key
|
||||
#
|
||||
# [*users*]
|
||||
# List of hashes with users information.
|
||||
#
|
||||
class mastodon (
|
||||
String $ensure = 'present',
|
||||
String $hostname = 'mastodon.example.org',
|
||||
|
@ -90,6 +93,7 @@ class mastodon (
|
|||
'IP_RETENTION_PERIOD' => 31556952,
|
||||
'SESSION_RETENTION_PERIOD' => 31556952,
|
||||
},
|
||||
Array $users = [],
|
||||
) {
|
||||
case $ensure {
|
||||
default: {
|
||||
|
@ -427,5 +431,24 @@ class mastodon (
|
|||
active => true,
|
||||
enable => true,
|
||||
}
|
||||
# create admin user
|
||||
$users.each | $user | {
|
||||
if ($user['confirmed']) {
|
||||
$confirmed = '--confirmed'
|
||||
} else {
|
||||
$confirmed = ''
|
||||
}
|
||||
exec { "create_user_${user['username']}":
|
||||
command => "${mastodon_home}/live/bin/tootctl accounts create '${user['username']}' --email '${user['email']}' ${confirmed} --role '${user['role']}' > '${mastodon_home}/create_user_${user['username']}'",
|
||||
creates => "${mastodon_home}/create_user_${user['username']}",
|
||||
path => "${mastodon_home}/.rbenv/shims:${mastodon_home}/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
environment => [
|
||||
'RAILS_ENV=production',
|
||||
],
|
||||
user => $mastodon_user,
|
||||
group => $mastodon_group,
|
||||
cwd => "${mastodon_home}/live",
|
||||
timeout => 0,
|
||||
require => File["${mastodon_home}/live/.env.production"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue