Ansible Meetup

Automation to infinity and beyond!


Pierre Mavro / @deimosfr

About the Speaker

Pierre Mavro / @Deimosfr

About Nousmotards

Nousmotards is a social network for bikers made by bikers:

  • Manage events
  • Create road books
  • Easily meet new friends
  • ...


Nousmotards Android Demo

About Founders


3 friends with the same passion

Why did we choose Ansible?

  • YAML make it simple and easy to read
  • Fast to write and execute
  • Agentless
  • Tons of available community plugins and role
  • Written in Python
  • Because that just ROX !!!

Nousmotards

Architecture overview

Deep dive

Architecture

Docker

  • What is Docker?
  • Simple to install (repo + packages)
  • Store images in a Docker registry (public/private)
  • Container versionning
  • Uses some LXC internals
  • Easy to use
  • Stable enough for small production

Packer

  • What is Packer?
  • Define source image
  • Pre scripts (ansible dependencies)
  • Run Ansible playbook
  • Post scripts (clean)
  • Export in wished format
  • Push to your Docker registry

Ansible

  • Store everything on Git
  • Avoid repetition (with_*)
  • Set multiple envs
  • Use vars at max
  • Use facts at max
  • Fail fast
  • Community: Ansible Galaxy

Smarter is better

Git

  • Keep / trace all updates from Ansible changes
  • Use hooks for sanity checks

Jenkins

Build apps with Docker
and publish to private repo

Jenkins

Build containers with Packer and Ansible
Then publish to registry

Deploy: Git + Jenkins

  • Git hooks and Jenkins's API
  • Define tag triggers within the team

Jenkins

Deploy new containers with Ansible

Harder, better,

faster, stronger

Consul

  • What is Consul?
  • Why using Consul?
  • Ansible deploy the servers
  • Ansible deploy the agents on containers
  • Register/unregister DNS entry with container start/stop
  • Use consul_io.py for Ansible inventory

Consul Template

  • Why is this needed?
  • Choose a Load Balancer (like Haproxy)
  • Use consul-template from Ansible Galaxy
  • Configure Consul template for Haproxy
  • Run it to get HAProxy updated with consul changes

Now it's OK!

Let's summarize it

Ansible is everywhere!!!

  • To build physical servers
  • To build containers
  • To deploy containers
  • Integrated with Git and Jenkins

Ansible contributions

  • Ansible Consul inventory
  • Roles we're sharing:
    • consul-template
    • elasticsearch
    • graphite
    • mariadb
    • neo4j
    • packer


https://galaxy.ansible.com/list#/users/3601

What's next?

  • Waiting for Ansible v2
  • Making functionnal tests with Ansible

Join us!

www.nousmotards.com

Ansible Meetup

www.nousmotards.com


Pierre Mavro / @deimosfr
Watch again: http://nousmotards.github.io/ansible-meetup-0915