Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
'''
This script converts the output of Ansible's dynamic host list ec2.py to a flatly formmated static inventory file.
Before running this script run `python ./ec2.py --refresh-cache > ansible-dynamic-host-list.json`
See: http://docs.ansible.com/ansible/ec2_module.html
'''
import json
from pprint import pprint
import operator
@mcbrihk
mcbrihk / README.markdown
Created February 9, 2016 21:31 — forked from klm1/README.markdown
check the plugin usage in jenkins

Keybase proof

I hereby claim:

  • I am mcbrihk on github.
  • I am mcbrihk (https://keybase.io/mcbrihk) on keybase.
  • I have a public key whose fingerprint is F621 0670 E8FE 544D 13DB 9535 E4E3 0CA3 170B A0AC

To claim this, I am signing this object:

@mcbrihk
mcbrihk / gist:039d5f56ff31bcf27c47
Created November 4, 2014 16:01
Download the latest snapshot from nexus using wget
Download the latest snapshot from nexus using wget
From Maven 3, support for uniqueVersion is disabled and when you distribute your snapshots by publishing them on nexus you end up with snapshot names ending with timestamps. Suddenly your QA or Integration server scripts start failing if you are getting war file from nexus repository as there is no unique name now.
To get the latest version of snapshot you can use a service available from Nexus as
wget -O my-services.war http://nexus.myorg.net/nexus/service/local/artifact/maven/redirect?r=snapshots\&g=my.company.product.services\&a=my-services\&v=1.0-SNAPSHOT\&p=war
Where
r is the id of the repository
g is the group id
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. It is very similar to MakeFiles and Ant Files. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

Installing Fabric

One of the best things about Fabric is that the systems which you are remotely administering require nothing beyond the standard OpenSSH server. The master server which you are running Fabric from will, however, need a few things installed before you can get started. Let's get started.

Requirements

  • Python 2.5+ with the development headers