Skip to content

Instantly share code, notes, and snippets.

@ipcrm
Created March 2, 2016 14:22
Show Gist options
  • Save ipcrm/bd592677a0fcebb859d7 to your computer and use it in GitHub Desktop.
Save ipcrm/bd592677a0fcebb859d7 to your computer and use it in GitHub Desktop.
Creating Users via Hieradata
users:
matt:
home: /home/matt
shell: /bin/bash
description: Matt Admin
tony:
home: /home/tony
shell: /bin/bash
description: Tony Admin
john:
home: /home/john
shell: /bin/bash
description: John Admin
joe:
home: /home/joe
shell: /bin/bash
description: Joe Admin
jill:
home: /home/jill
shell: /bin/bash
description: Jill Admin
define test::create_user (
$shell,
$description,
$home,
) {
user{$title:
shell => $shell,
comment => $description,
home => $home,
}
### Whatever other org specific stuff you want to do
}
class test::setup_users {
$users = hiera('users')
$users.keys.each |$user| {
test::create_user {$user:
shell => $users[$user]['shell'],
home => $users[$user]['home'],
description => $users[$user]['description'],
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment