Created
March 2, 2016 14:22
-
-
Save ipcrm/bd592677a0fcebb859d7 to your computer and use it in GitHub Desktop.
Creating Users via Hieradata
This file contains 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
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