aboutsummaryrefslogtreecommitdiff
path: root/manifests/authorized_user_ids.pp
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2013-10-16 15:06:00 -0400
committerAntoine Beaupré <anarcat@koumbit.org>2013-10-16 15:06:00 -0400
commit7218eb738f4d4cbcade57cdf72c7cd6c878cd60e (patch)
tree498abe5e6b8cab2c31156b9edac08c40533afd20 /manifests/authorized_user_ids.pp
parent5ac51aa1072c59e7998602a8466cd9bbc2aa8cef (diff)
downloadpuppet-monkeysphere-7218eb738f4d4cbcade57cdf72c7cd6c878cd60e.tar.gz
puppet-monkeysphere-7218eb738f4d4cbcade57cdf72c7cd6c878cd60e.tar.bz2
split into separate file according to autoloading rules
Diffstat (limited to 'manifests/authorized_user_ids.pp')
-rw-r--r--manifests/authorized_user_ids.pp48
1 files changed, 48 insertions, 0 deletions
diff --git a/manifests/authorized_user_ids.pp b/manifests/authorized_user_ids.pp
new file mode 100644
index 0000000..d400890
--- /dev/null
+++ b/manifests/authorized_user_ids.pp
@@ -0,0 +1,48 @@
+define monkeysphere::authorized_user_ids( $user_ids, $dest_dir = '/root/.monkeysphere', $dest_file = 'authorized_user_ids', $group = '') {
+ $user = $title
+ $calculated_group = $group ? {
+ '' => $user,
+ default => $group
+ }
+
+ # don't require user if it's root because root is not handled
+ # by puppet
+ case $user {
+ root: {
+ file {
+ $dest_dir:
+ owner => $user,
+ group => $calculated_group,
+ mode => 755,
+ ensure => directory,
+ }
+ }
+ default: {
+ file {
+ $dest_dir:
+ owner => $user,
+ group => $calculated_group,
+ mode => 755,
+ ensure => directory,
+ require => User[$user]
+ }
+ }
+ }
+
+ file {
+ "${dest_dir}/${dest_file}":
+ owner => $user,
+ group => $calculated_group,
+ mode => 644,
+ content => template('monkeysphere/authorized_user_ids.erb'),
+ ensure => present,
+ recurse => true,
+ require => File[$dest_dir]
+ }
+
+ exec { "monkeysphere-authentication update-users $user":
+ refreshonly => true,
+ require => [ File["monkeysphere_authentication_conf"], Package["monkeysphere"] ],
+ subscribe => File["${dest_dir}/${dest_file}"]
+ }
+}