Created
May 8, 2013 21:42
-
-
Save jerrac/5543893 to your computer and use it in GitHub Desktop.
Rough draft of userwrapper puppet module
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
sshpubkeys/username.json | |
{ | |
"type": "id_rsa", | |
"key": "really long key", | |
"name": "blah@blah" | |
} | |
sshpubkeys/reagand.json | |
{ | |
"type": "id_rsa", | |
"key": "really long key", | |
"name": "blah@blah" | |
} | |
users/reagand.json | |
{ | |
"userwrapper::username": "reagand", | |
"userwrapper::fullname": "David Reagan", | |
"userwrapper::ensure": "present", | |
"userwrapper::password": "hashedpass", | |
"userwrapper::authorizedSSHKeys": ["username","reagand"], | |
"userwrapper::email": "[email protected]", | |
"userwrapper::home": "/home/reagand", | |
"userwrapper::managehome": "true", | |
"userwrapper::shell": "/bin/bash", | |
"userwrapper::uid": "10001", | |
"userwrapper::groups": "developers" | |
} | |
init.pp | |
class userwrapper( | |
$username, | |
$fullname, | |
$ensure, | |
$password, | |
$authorizedSSHKeys, | |
$email, | |
$home, | |
$managehome, | |
$shell, | |
$uid, | |
$groups | |
) | |
{ | |
user { $username: | |
comment => $username, | |
ensure => $ensure, | |
password => $password, | |
managehome => $managehome, | |
home => $home, | |
name => $username, | |
shell => $shell, | |
uid => $uid | |
} | |
# Do something with the groups to make sure we don't add nonexistent groups... | |
# read $authorizedSSHKeys | |
# if using example files... | |
# Grab sshpubkeys/reagand.json and sshpubkeys/username.json | |
# add a unique value to the name property | |
# run create_resources(ssh_authorized_key, $whatever is in the json file) for both keys. | |
} | |
node.pp | |
server.fqdn { | |
include userwrapper | |
create_resources(userwrapper,"reagand") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment