Created
October 16, 2015 12:27
-
-
Save brettswift/efb777189e738a1f8dec to your computer and use it in GitHub Desktop.
Puppet Accounts 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
| class accounts ( | |
| $virtual_accounts = {}, | |
| $defaults = {}, | |
| ) { | |
| $realize = hiera_array('accounts') | |
| group { 'sudo-dev': | |
| ensure => present, | |
| gid => 514, | |
| } | |
| create_resources('@accounts::virtual', $virtual_accounts, $defaults) | |
| realize (Accounts::Virtual[$realize]) | |
| } | |
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
| define accounts::virtual ( | |
| $uid = undef, | |
| $comment = undef, | |
| $password = undef, | |
| ) { | |
| user { $title: | |
| ensure => 'present', | |
| uid => $uid, | |
| gid => $title, | |
| shell => '/bin/bash', | |
| home => "/home/${title}", | |
| comment => $comment, | |
| groups => ['sudo-dev'], | |
| password => $password, | |
| managehome => true, | |
| } | |
| group { $title: | |
| gid => $uid, | |
| } | |
| } |
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
| accounts: | |
| - user_one | |
| - user_two |
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
| accounts::defaults: #unknown | |
| password: '$6$5COqysSv$3x5pUIOg/xxr0KmYKtsdBio.Y7b7CveWVSaZ3/jVrDgtmHrHkwZkHIh5ckyY3AmCR0Fz.zM4o9X/MMkFhsWYf0' | |
| accounts::virtual_accounts: | |
| 'user_one': | |
| uid: 6246 | |
| comment: 'User One' | |
| password: 'paste in a (partial) hash from /etc/shadow' | |
| 'user_two': | |
| uid: 6247 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment