|
| 1 | +# This class wraps the puppetlabs/accounts module and the native |
| 2 | +# group type to create accounts and groups from hiera. |
| 3 | +# |
| 4 | +# Enteries in Hiera should look like this: |
| 5 | +# |
| 6 | +# accounts_hash: |
| 7 | +# bob: |
| 8 | +# uid: '4001' |
| 9 | +# gid: '4001' |
| 10 | +# shell: '/bin/bash' |
| 11 | +# password: '!!' |
| 12 | +# sshkeys: |
| 13 | +# - 'ssh-rsa AAAA...' |
| 14 | +# locked: false |
| 15 | +# sue: |
| 16 | +# uid: '4002' |
| 17 | +# gid: '4002' |
| 18 | +# shell: '/bin/ksh' |
| 19 | +# password: '!!' |
| 20 | +# sshkeys: |
| 21 | +# - 'ssh-rsa BBBB...' |
| 22 | +# locked: false |
| 23 | +class profile::accounts ( |
| 24 | + $accounts = hiera_hash('accounts_hash',{}), |
| 25 | + $groups = hiera_hash('groups_hash',{}), |
| 26 | +) { |
| 27 | + |
| 28 | + $accounts.each |$key, $value| { |
| 29 | + accounts::user { $key: |
| 30 | + ensure => $value['ensure'], |
| 31 | + shell => $value['shell'], |
| 32 | + comment => $value['comment'], |
| 33 | + home => $value['home'], |
| 34 | + home_mode => $value['home_mode'], |
| 35 | + uid => $value['uid'], |
| 36 | + gid => $value['gid'], |
| 37 | + groups => $value['groups'], |
| 38 | + membership => $value['membership'], |
| 39 | + password => $value['password'], |
| 40 | + locked => $value['locked'], |
| 41 | + sshkeys => $value['sshkeys'], |
| 42 | + managehome => $value['managehome'], |
| 43 | + bashrc_content => $value['bashrc_content'], |
| 44 | + bash_profile_content => $value['bash_profile_content'], |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + $groups.each |$key, $value| { |
| 49 | + group { $key: |
| 50 | + ensure => $value['ensure'], |
| 51 | + allowdupe => $value['allowdupe'], |
| 52 | + attribute_membership => $value['attribute_membership'], |
| 53 | + attributes => $value['attributes'], |
| 54 | + auth_membership => $value['auth_membership'], |
| 55 | + forcelocal => $value['forcelocal'], |
| 56 | + gid => $value['gid'], |
| 57 | + ia_load_module => $value['ia_load_module'], |
| 58 | + members => $value['members'], |
| 59 | + provider => $value['provider'], |
| 60 | + system => $value['system'], |
| 61 | + } |
| 62 | + } |
| 63 | +} |
0 commit comments