Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Created November 10, 2012 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottslowe/4049439 to your computer and use it in GitHub Desktop.
Save scottslowe/4049439 to your computer and use it in GitHub Desktop.
Puppet defined type for creating virtual user resources
# Defined type for creating virtual user accounts
#
define accounts::virtual ($uid,$gid,$realname,$pass,$sshkey="") {
@user { $title:
ensure => 'present',
uid => $uid,
gid => $gid,
shell => '/bin/bash',
home => "/home/${title}",
comment => $realname,
password => $pass,
managehome => true,
}
if ( $sshkey != "" ) {
@ssh_authorized_key { $title:
ensure => 'present',
type => 'ssh-rsa',
key => $sshkey,
user => $title,
require => User[$title],
name => $title,
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment