I need to do the same process over and over again for numerous users.  What
would be the easy way to create a class or function to wrap the following
code so that each time I need to do the following it's a single line of
code.  Currently what' I've been doing is copying the 35 lines of code and
duplicating it for hundreds of users.

$username_john = hiera ( 'ftp_username_john' )
$password_john = hiera ( 'ftp_password_john' )

user { "${username_john}":
  ensure      => present,
  password    => "${password_john}",
  managehome  => false,
  home        => '/incoming',
  groups      => 'sftpusers',
  shell       => '/sbin/nologin',
}

file { "/sftp/${username_john}":
  ensure  => directory,
  owner   => 'root',
  group   => 'root',
  mode    => '0755',
  require => File['/sftp'],
}

file { "/sftp/${username_john}/incoming":
  ensure  => directory,
  owner   => $username_john,
  group   => 'sftpusers',
  mode    => '0755',
  require => File["/sftp/${username_john}"],
}

file { "/sftp/${username_john}/outgoing":
  ensure  => directory,
  owner   => $username_john,
  group   => 'sftpusers',
  mode    => '0755',
  require => File["/sftp/${username_john}"],
}


Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOTD2YS8tqLoruzLB_ty3YS%3DUkgyVspQBm5mG-v%3DA71PQJKg-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to