Coder Social home page Coder Social logo

detective-agency's Introduction

image

the devops detective-agency

It was a cloudy Tuesday afternoon when it walked into my office, an ubuntu-lts server from North East data centah', with ethernet cord from her hard-drives to the floor. There was nothing but bad news in her logs, and I had a good idea how it got there... It had a problem, the ruby was missing... and thats when I knew I had a job to do!

how to solve the case

detective-agency will read a Detectivefile, look at the facts, and generate an ansible playbook that should solve your case.

Take for example the case of the missing ruby:

# find the ruby interperter's version
#
investigate! :name => %q{ruby tuesday} do
  stake_out? %q{ruby -v | grep 'ruby 1.8'} do
    usual_suspects! :apt => "pkg=ruby1.8 state=absent"
  end

  stake_out! %q{ruby -v | grep 'ruby 1.9'} do
    usual_suspects! :apt => "pkg=ruby1.9.3 state=latest"
  end
end

You could then run detective-agency feeding its output to ansible:

$ detective-agency | tee install-ruby.yml
---
- hosts: all
  tasks:
  - shell: ruby -v | grep 'ruby 1'
    register: last_command
    ignore_errors: true
  - apt: pkg=ruby state=latest
    sudo: tru
    when: last_command.rc != 0
...

$ ansible-playbook -i inventory install-ruby.yml 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [shell ruby -v | grep 'ruby 1'] ***************************************** 
changed: [localhost]

TASK: [apt pkg=ruby state=latest] ********************************************* 
skipping: [localhost]

PLAY RECAP ******************************************************************** 
localhost       : ok=2    changed=1    unreachable=0    failed=0

install from PPA

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 14F4C975
echo "deb http://ppa.launchpad.net/diclophis/detective-agency/ubuntu precise main" | sudo tee /etc/apt/sources.list.d/diclophis.list
sudo apt-get update
sudo apt-get install detective-agency

detective-agency's People

Contributors

diclophis 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.