Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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