Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Created November 10, 2012 06:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottslowe/4050213 to your computer and use it in GitHub Desktop.
Save scottslowe/4050213 to your computer and use it in GitHub Desktop.
Final (simplified) defined type for creating virtual user acounts
# Defined type for creating virtual user accounts
#
define accounts::virtual ($uid,$realname,$pass) {
user { $title:
ensure => 'present',
uid => $uid,
gid => $title,
shell => '/bin/bash',
home => "/home/${title}",
comment => $realname,
password => $pass,
managehome => true,
require => Group[$title],
}
group { $title:
gid => $uid,
}
file { "/home/${title}":
ensure => directory,
owner => $title,
group => $title,
mode => 0750,
require => [ User[$title], Group[$title] ],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment