Skip to content

Created example accounts profile and updated Puppetfile to include pu… #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod "puppetlabs/stdlib", '4.11.0'
mod "puppetlabs/concat", '2.1.0'
mod "hunner/hiera", '2.0.1'
mod "npwalker/pe_code_manager_webhook", '1.0.8'
mod "puppetlabs/accounts", '1.0.0'

# Modules from Github using various references
# Further examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples
Expand Down
63 changes: 63 additions & 0 deletions site/profile/manifests/accounts.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This class wraps the puppetlabs/accounts module and the native
# group type to create accounts and groups from hiera.
#
# Enteries in Hiera should look like this:
#
# accounts_hash:
# bob:
# uid: '4001'
# gid: '4001'
# shell: '/bin/bash'
# password: '!!'
# sshkeys:
# - 'ssh-rsa AAAA...'
# locked: false
# sue:
# uid: '4002'
# gid: '4002'
# shell: '/bin/ksh'
# password: '!!'
# sshkeys:
# - 'ssh-rsa BBBB...'
# locked: false
class profile::accounts (
$accounts = hiera_hash('accounts_hash',{}),
$groups = hiera_hash('groups_hash',{}),
) {

$accounts.each |$key, $value| {
accounts::user { $key:
ensure => $value['ensure'],
shell => $value['shell'],
comment => $value['comment'],
home => $value['home'],
home_mode => $value['home_mode'],
uid => $value['uid'],
gid => $value['gid'],
groups => $value['groups'],
membership => $value['membership'],
password => $value['password'],
locked => $value['locked'],
sshkeys => $value['sshkeys'],
managehome => $value['managehome'],
bashrc_content => $value['bashrc_content'],
bash_profile_content => $value['bash_profile_content'],
}
}

$groups.each |$key, $value| {
group { $key:
ensure => $value['ensure'],
allowdupe => $value['allowdupe'],
attribute_membership => $value['attribute_membership'],
attributes => $value['attributes'],
auth_membership => $value['auth_membership'],
forcelocal => $value['forcelocal'],
gid => $value['gid'],
ia_load_module => $value['ia_load_module'],
members => $value['members'],
provider => $value['provider'],
system => $value['system'],
}
}
}