Created
February 18, 2015 14:41
-
-
Save aduitsis/a2910f43f722bed33cb0 to your computer and use it in GitHub Desktop.
Password file to puppet manifest
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
#!/usr/local/bin/perl -w | |
use v5.16; | |
use strict; | |
use warnings; | |
while(<>) { | |
chomp; | |
my ( $username, $password, $uid, $gid, $class, $change, $expire, $gecos, $home, $shell ) = split ':' // die "cannot parse $_"; | |
my $group = getgrgid($gid) // die "error, group-id $gid cannot be found in this system"; | |
say <<EOM | |
user { '$username': | |
ensure => present, | |
password => '$password', | |
home => '$home', | |
shell => '$shell', | |
comment => '$gecos', | |
uid => $uid, | |
gid => '$group', | |
managehome => true, | |
} | |
EOM | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment