Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ansible (PyCON 2014, Montreal)

Ansible (PyCON 2014, Montreal)

This is not a presentation for reading by itself, but is uploaded for those who are watching along with the video here: https://www.youtube.com/watch?v=Qi0AhK7PMCI

3c1b7e921632632e11d5d2ee59403f5f?s=128

Michael DeHaan

April 27, 2014
Tweet

Transcript

  1. Automating With Michael DeHaan

  2. BACKGROUND...

  3. THE ANSIBLE STORY... Red Hat: Cobbler/Func Other Tools... Hosted Deployments...

    Lightbulb...
  4. WHAT IS ANSIBLE?

  5. APPLICATION DEPLOYMENT

  6. CONFIGURATION MANAGEMENT

  7. CLOUD PROVISIONING

  8. AD-HOC TASK EXECUTION

  9. MULTI-TIER ORCHESTRATION & CONTINOUS DEPLOYMENT

  10. PHILOSOPHY

  11. AGENTLESS!

  12. SHOULDN'T BE YOUR DAY JOB

  13. KEEP THINGS SIMPLE / AUDITABILITY

  14. BATTERIES INCLUDED (224 MODULES IN CORE)

  15. SOME STATISTICS AND INFO

  16. ANSIBLE IS ~2 YEARS OLD

  17. TOP 5 MOST CONTRIBUTIONS ON GITHUB IN 2013 (665+) Others

    were Angular.js, Rails, CocoaPods, and Homebrew
  18. TOP 10 PYTHON PROJECT ON GITHUB FOR STARS (5400+) &

    FORKS (1600+)
  19. NEW CONTRIBUTOR ADDED LESS THAN EVERY ~1.3 DAYS

  20. USE CASES EXAMPLES edX.org and Fedora Infrastructure - OSSed content!

    Gawker - continuously deploying 5-10 times an hour MapR - product installer Rackspace - orchestrate production OpenStack upgrades Care.com, GoPro, Hootsuite, Evernote, ...
  21. EXAMPLE TIME!

  22. INVENTORY [ w e b s e r v e

    r s ] o n e . e x a m p l e . c o m t w o . e x a m p l e . c o m
  23. AD-HOC MODE # a n s i b l e

    w e b s e r v e r s - m p i n g o n e . e x a m p l e . c o m | s u c c e s s > > { " p i n g " : " p o n g " } t w o . e x a m p l e . c o m | s u c c e s s > > { " p i n g " : " p o n g " } # a n s i b l e w e b s e r v e r s - m s h e l l - a " s h u t d o w n - t 1 2 0 "
  24. PLAYBOOKS # a n s i b l e -

    p l a y b o o k s i t e . y m l - h o s t s : w e b s e r v e r s r o l e s : - b a s e - w e b s e r v e r - m o n i t o r e d
  25. ROLES STRUCTURE r o l e s / w e

    b s e r v e r / t a s k s / h a n d l e r s / f i l e s / t e m p l a t e s / d e f a u l t s / v a r s / m e t a /
  26. EXAMPLE TASK FILE - y u m : n a

    m e = h t t p d s t a t e = i n s t a l l e d - t e m p l a t e : s r c = h t t p d . c o n f . j 2 d e s t = / e t c / h t t p d / h t t p d . c o n f n o t i f y : - r e s t a r t h t t p d - s e r v i c e : n a m e = h t t p d s t a t e = r u n n i n g
  27. TIPS!

  28. ANSIBLE GALAXY galaxy.ansible.com about to come out of beta backed

    by github (issue tracking, etc) ~450 roles and 2500 users in ~4 months a n s i b l e - g a l a x y i n i t r o l e n a m e a n s i b l e - g a l a x y i n s t a l l u s e r n a m e . r o l e n a m e
  29. ANSIBLE VAULT a n s i b l e -

    v a u l t c r e a t e f o o . y m l a n s i b l e - v a u l t e d i t f o o . y m l a n s i b l e - v a u l t e n c r y p t f o o . y m l a n s i b l e - v a u l t d e c r y p t f o o . y m l a n s i b l e - v a u l t r e k e y f o o . y m l a n s i b l e - p l a y b o o k f o o . y m l - - a s k - v a u l t - p a s s
  30. ROLLING UPDATE EXAMPLE - h o s t s :

    w e b s e r v e r s s e r i a l : 5 p r e _ t a s k s : - n a m e : t a k e o u t o f l o a d b a l a n c e r p o o l l o c a l _ a c t i o n : c o m m a n d / u s r / b i n / t a k e _ o u t _ o f _ p o o l { { i n v e n t o r y _ h o s t n a m e } } r o l e s : - c o m m o n - w e b s e r v e r - m o n i t o r e d p o s t _ t a s k s : - n a m e : a d d b a c k t o l o a d b a l a n c e r p o o l l o c a l _ a c t i o n : c o m m a n d / u s r / b i n / a d d _ b a c k _ t o _ p o o l { { i n v e n t o r y _ h o s t n a m e } }
  31. EXTENDING ANSIBLE WITH PYTHON ...

  32. MODULES can implement in any language that can emit JSON

    or even return key=value and write one in bash core modules are all Python
  33. PLUGINS lookup plugins / enumerations connection plugins action plugins filter

    plugins (extend Jinja2) inventory (next slide)
  34. INVENTORY SCRIPTS Examples include OpenStack, AWS, and Rackspace any executable

    program that can emit JSON core/examples plugins are all Python
  35. API/REST API python API for runner -- not the main

    purpose of the app REST API is part of Tower, fully discoverable, annotated, and awesome props to Django-REST-Framework
  36. INTERNALS

  37. REQUIREMENTS 2.6+ on server, 2.4+ on nodes python 2 for

    now (with good reasons) RHEL 5, I'm looking at you no bootstrapping philosophy
  38. MODULES WE USE HEAVILY multiprocessing native openssh and paramiko PyYAML,

    json Jinja2 subprocess
  39. CONTACT INFO & RESOURCES http://ansible.com michael@ansible.com twitter: @ansible & @laserllama

  40. WE ARE HIRING! (DURHAM, NC) API (Django, django-rest-framework, Celery, ...)

    QA (Automation) UI (Angular.js) Core (Python) email michael@ansible.com