daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. define add_user () {          
  2.   $username = $title
  3.  
  4.   user { $username:
  5.     ensure => present,
  6.     home => "/home/$username",
  7.     mode => "755",
  8.   }
  9.  
  10.   group { $username:
  11.     ensure => present,
  12.     require => user[$username],
  13.   }
  14.  
  15.   file { "/home/$username/":
  16.     ensure => directory,
  17.     owner => $username,
  18.     group => $username,
  19.     mode => 755,
  20.     require => [user[$username],group[$username]]
  21.   }
  22.  
  23.   file { "/home/$username/.ssh/":
  24.     ensure => directory,
  25.     owner => $username,
  26.     group => $username,
  27.     mode => 700,
  28.     require => file["/home/$username/"]
  29.   }
  30.  
  31.   file { "/home/$username/.ssh/authorized_keys":
  32.     ensure => present,
  33.     owner => $username,
  34.     group => $username,
  35.     mode => 600,
  36.     require => file["/home/$username/.ssh/",
  37.     source => "puppet:///modules/user_control/$username.pub"
  38.   }
  39. }
  40.  
  41. class user_control::add_user {
  42.   # add users based on roles
  43.   case $role {
  44.     'www': { add_user{ userA: } }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top