Created
February 18, 2015 14:41
-
-
Save aduitsis/a2910f43f722bed33cb0 to your computer and use it in GitHub Desktop.
Revisions
-
aduitsis created this gist
Feb 18, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/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 }