Advertisement
Guest User

scratch management

a guest
Aug 30th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 0.56 KB | None | 0 0
  1. $users = generate("/bin/bash", "-c", "awk -F':' '{if (\$3 >= 500 && \$3 != 65534) print \$1}' /etc/passwd")
  2. $users_array = split($users, '\n')
  3.  
  4. file { '/state/partition1/scratch':
  5.   ensure => 'directory',
  6.   mode   => '0777',
  7. }
  8.  
  9. file { '/scratch':
  10.   ensure => 'link',
  11.   target => '/state/partition1/scratch',
  12.   require => File["/state/partition1/scratch"],
  13. }
  14.  
  15. $users_array.each |String $user| {
  16.   file { "/scratch/$user":
  17.     ensure => 'directory',
  18.     mode => '0700',
  19.     owner => "$user",
  20.     group => "$user",
  21.     require => File["/scratch"],
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement