Giter Club home page Giter Club logo

randle's Introduction

Randle - server configuration tool

(named after Randle McMurphy - because this approach miight be slightly deranged)

Synopsis

Given a pool of servers, and a bunch of provisioning shell scripts, randle opens an ssh connection to each server and runs the scripts.

This application was written as a challenge for a job interview with Slack.com, but since I worked quite hard on it, I thought it might be of interest to others.

Features

  • Multiple servers can be provisioned simultaneously

  • Un-opinionated provisioning - they're your provisioning scripts

  • Idempotent, only performs the provisioning tasks that need to be done

Quick start

A command like this will connect to three servers and provision them with the scripts in the directory you specify:

python -m randle -d server-todo/ -u USERNAME -p PASSWORD -a 192.168.1.7 -a 192.168.1.8 -a 192.168.1.9 

And take a quick look at the options:

python -m randle --help

Note: if you run python setup.py install --user it will build a standalone randle binary in ~/.local/bin/.

More info...

The -d argument lets you specify a folder that contains provisioning scripts that you want to execute on a server. It is up to you to make your scripts idempotent. Ensure your scripts exit with a non-zero status if they fail.

server-todo/004-update-config.sh

#!/bin/bash

grep "some config option" /etc/config.something || run=1

if [ "${run}" ]; then
  echo "Missing the config option! Writing it now..." > /dev/stderr
  echo "some config option" > /etc/config.something
fi

Note that by echoing some info to stderr, this tool interprets that as a message that the user should see.

Ideas for the future

  • Interrogate a load balancer to dynamically determine the instances beneath it that require provisioning

  • Support for pre-hook operations and post-hook operations (for deploy strategies)

  • Or built-in deployment strategies, rolling, blue-green, red-black, canary deployment?

  • Scripts are not OS agnostic. Ie, apt vs yum etc. But the OS agnostic abstraction can be pretty leaky.

  • Only does IP addresses at the moment (doesn't resolve hostnames)

  • The pre-hook could provision a brand new server(s) and could theoretically return the IP address to the main randle process in some fashion, so that the new server can be provisioned (for eg red-black deploys)

  • Add support for privilege escalation, and ssh keys for auth

Dependencies

  • Python 2.7.9 (it may Just Work on other versions too)

  • Python Paramiko (I'm using python-paramiko/stable,now 1.15.1-1 on debian:jessie)

randle's People

Contributors

alexlance avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.