Drone your Ansible

Preview:

DESCRIPTION

Testing Ansible code with Drone.

Citation preview

Drone your Ansible

Dennis Rowe @shr3kst3r

wpengine.com

Drone

•https://github.com/drone/drone

•“Drone is a Continuous Integration platform built on Docker, written in Go”

•Buzzword score: 4

Show Time

•Deploy Droid

•Hook it up to Github

•Test some Ansible code

•Poke around the Drone UI

Update Kernel

•apt-get update

•apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

•reboot

Install Docker• apt-key adv --keyserver hkp://

keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

• sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"

• apt-get update

• apt-get install lxc-docker

Install Drone

•wget http://downloads.drone.io/latest/drone.deb

•dpkg -i drone.deb

•start drone

http://IP/install

Register Drone with Github

Important Numbers

Add to Drone

New Repository

Authorize

Add Repository

Notes

•First run can take a looooong time because it needs to download the Docker image.

Completed Run

Poking at Docker

Now the Configuration

Pull

•GitHub

•BitBucket

Deployment•Cloud Foundry

•Engine Yard

•Git Push

•Bash

•Heroku

•Modulus

•Nodejitsu

•Tsuru

Publish

•S3

•Swift

•PyPI

•NPM

•Docker

Services•cassandra

•couchdb

•elasticsearch

•neo4j

•mongodb

•mysql

•postgres

•rabbitmq

•redis

•riak

•zookeeper

Notifications

•E-Mail

•Webhook

•Hipchat

Other Stuff

•Can launch custom Docker containers

•Can persist directories between builds

•Parameter injection in to the .drone.yml

.drone.ymlimage: python2.7 env: script: - sudo apt-get update - sudo apt-get install software-properties-common - sudo apt-add-repository ppa:ansible/ansible - sudo apt-get update - sudo apt-get install ansible - sudo pip install https://github.com/willthames/ansible-lint/archive/master.zip - sudo apt-get install rubygems - sudo gem install serverspec - sudo gem install rake - sudo ./drone_it notify: email: recipients: - dennis@wpengine.com

drone_it

•Lints the Ansible code

•Deploys the Ansible code

•Runs server-spec to verify

•https://github.com/shr3kst3r/ansible-drone-example/blob/master/drone_it

Thoughts

•Would like to be able to test multiple docker images (https://github.com/drone/drone/issues/6).

•Hard to create complex setups.

•Can’t edit /etc/hosts because it is a bind mount.

Odds and Ends

•https://github.com/shr3kst3r/ansible-drone-example

•You can reach me at dennis@wpengine.com or @shr3kst3r on the twitters

Recommended