Skip to content

Instantly share code, notes, and snippets.

@riaf
Created March 13, 2013 11:18
Show Gist options
  • Save riaf/5151207 to your computer and use it in GitHub Desktop.
Save riaf/5151207 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var https = require('https')
, fs = require('fs')
, async = require('async');
var users = [
{
id: "riaf",
password: "$1$ZHEt3vNX$8pQ/szk.keG9.QAgY6sI4/",
groups: [ "sysadmin" ],
uid: 2001,
shell: "/usr/bin/zsh"
}
];
async.each(users, function(user, next) {
https.get('https://github.com/' + user.id + '.keys', function(response) {
response.on('data', function(d) {
user.ssh_keys = d.toString('utf-8').split("\n");
next(user);
});
});
}, function(user) {
fs.writeFile(__dirname + '/../data_bags/users/' + user.id + '.json', JSON.stringify(user, null, ' '), 'utf-8');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment