Index: modules/users/manifests/init.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/users/manifests/init.pp |
@@ -0,0 +1,45 @@ |
+class users { |
+ define user ( |
+ $user_name = $title, |
+ $authorized_keys, |
+ $password = undef, |
+ $groups = [], |
+ ) { |
+ user {$user_name: |
+ home => "/home/${user_name}", |
+ shell => "/bin/bash", |
+ managehome => true, |
+ password => $password, |
+ groups => $groups, |
+ } |
+ |
+ file {"/home/${user_name}/.ssh": |
+ ensure => directory, |
+ owner => $user_name, |
+ mode => 0700, |
+ require => User[$user_name] |
+ } |
+ |
+ file {"/home/${user_name}/.ssh/authorized_keys": |
+ ensure => present, |
+ owner => $user_name, |
+ content => $authorized_keys |
+ } |
+ } |
+ |
+ user {'root': |
+ password => '*' |
+ } |
+ |
+ file {'/root/.ssh/authorized_keys': |
+ ensure => absent |
+ } |
+ |
+ file {'/etc/sudoers.d/puppet': |
+ ensure => present, |
+ owner => root, |
+ group => root, |
+ mode => 0440, |
+ source => 'puppet:///modules/users/sudoers-puppet' |
+ } |
+} |