Created
November 10, 2012 01:44
-
-
Save scottslowe/4049439 to your computer and use it in GitHub Desktop.
Puppet defined type for creating virtual user resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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