ansible, idempotency, and jenkins

14
Ansible, Idempotency, and Jenkins Tyler Turk DevOps Engineer - WP Engine

Upload: tylerturk

Post on 15-Jul-2015

252 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Ansible, Idempotency, and Jenkins

Ansible, Idempotency,

and Jenkins

Tyler Turk

DevOps Engineer - WP Engine

Page 2: Ansible, Idempotency, and Jenkins

Brief Introduction on Me

DevOps Engineer at WP Engine

Passionate Ansible Advocate

Loves python and automation

Page 3: Ansible, Idempotency, and Jenkins

Purpose of this talk?

Empower YOU to:

Use ansible and vagrants

Understand importance of idempotency

Test for idempotent playbooks

Page 4: Ansible, Idempotency, and Jenkins

What is Ansible?The TL;DR Version

Page 5: Ansible, Idempotency, and Jenkins

What does idempotency

mean?Why is this important? Why do we care?

Page 6: Ansible, Idempotency, and Jenkins

What is jenkins?

Job scheduler

Job monitor

Job executor

Awesome

Page 7: Ansible, Idempotency, and Jenkins

What is Jenkins not?

Page 8: Ansible, Idempotency, and Jenkins

Want to follow along?

Vagrant:

https://github.com/tylerturk/jenkins_ansible_id

empotent_test_vagrant

Playbooks:

https://github.com/tylerturk/jenkins_ansible_id

empotent_test

Page 9: Ansible, Idempotency, and Jenkins

Issues Faced

docker_image module is deprecated

SSH on Docker is considered evil

(https://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/)

wait_for module just waits for TCP

connectivity

(http://docs.ansible.com/wait_for_module.html)

Page 10: Ansible, Idempotency, and Jenkins

How are we doing this?

Custom python script

Ansible python API

Validating returned data

Page 11: Ansible, Idempotency, and Jenkins

What’s under the covers?Vagrant provisioned with jenkins and docker

Vagrant builds a docker image that has

ansible

Jenkins provisions docker container with

ansible

Custom python script runs playbook a second

time

Returned results are then validated

Page 12: Ansible, Idempotency, and Jenkins
Page 13: Ansible, Idempotency, and Jenkins

Idempotent vs Not

Idempotent

Uses correct ansible

module

Job successfully builds

Profit!

Touches a file

Job fails miserably

Profit!

Page 14: Ansible, Idempotency, and Jenkins

How can we make this

better?

Identify file and line number of non-

idempotent task

Use with docker and SSH

Improve callback to not write local file

Move traceback to more visible