Skip to content

Instantly share code, notes, and snippets.

@zamoose
Created August 25, 2011 20:00
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 zamoose/1171709 to your computer and use it in GitHub Desktop.
Save zamoose/1171709 to your computer and use it in GitHub Desktop.
Useful Puppet user definitions
# Hopefully someone else will find these snippets useful. I've found them VERY
# helpful in defining local users that hew to the generally-accepted RedHat-ism
# of [local username] having an equivalent [local user primary group] with uid = gid.
# Improvements welcomed.
#
# ROCKS Cluster users generally need access to scratch directories on local storage,
# hence their more expansive definitions.
#
# This file should probably go in your [Puppet config dir]/manifests/definitions/
#
define config_cluster_user($uid, $gid, $comment, $groups = "" ){
group { $name:
ensure => present,
gid => $gid,
} -> user { $name:
ensure => present,
uid => $uid,
gid => $gid,
groups => $groups,
comment => $comment,
managehome => true,
}
file{ "/scr1/$name":
mode => "751",
owner => $name,
group => $name,
ensure => directory,
}
file{ "/scr2/$name":
mode => "751",
owner => $name,
group => $name,
ensure => directory,
}
}
define config_local_user($uid, $gid, $comment){
group { $name:
ensure => present,
gid => $gid,
}-> user { $name:
ensure => present,
uid => $uid,
gid => $gid,
comment => $comment,
managehome => true,
}
}
@zamoose
Copy link
Author

zamoose commented Aug 25, 2011

Huh -- github doesn't understand Puppet manifests for syntax highlighting, I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment