Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ansible + Drupal: A Fortuitous DevOps Match

6,810 views

Published on

Video: https://www.youtube.com/watch?v=OagmOcyQl0g

Human-readable configuration syntax. Great user experience. Designed for high availability and flexibility. Includes everything you need to achieve your development goals.

Am I describing Drupal 8? Well, all the above applies... but I'm actually describing Ansible, the tool for managing your infrastructure. Ansible does server provisioning, configuration management, deployments, and everything else you need to get your organization moving towards a brighter DevOps future, and it does everything more efficiently and more easily than other solutions!

In this presentation, I'll guide you through the basics of Ansible, and then demonstrate Ansible on the Dramble[1]—a cluster of Raspberry Pi 2 computers that fits in the palm of your hand!

Jeff Geerling is the author of Ansible for DevOps[2].

[1] https://github.com/geerlingguy/raspberry-pi-dramble
[2] http://ansiblefordevops.com/

Published in: Software

Ansible + Drupal: A Fortuitous DevOps Match

  1. 1. Ansible + Drupal A fortuitous DevOps Match #MidCamp 2015 Jeff Geerling Technical Architect, Acquia ________________________________________ / "Automation shouldn't be your day job" #ansible #pycon2014 / ---------------------------------------- ^__^ (oo)_______ (__) )/ ||----w | || ||
  2. 2. Who am I? Jeff Geerling (geerlingguy) Technical Architect, Acquia Owner, Midwestern Mac LLC Dev (mainly)
  3. 3. Ansible for DevOps On LeanPub Nearly complete! 50% off: http://bit.ly/midcamp-a4d
  4. 4. Problems Growing infrastructure. Drupal deployments are complex. More deployments, more downtime. <insert your problem here>
  5. 5. “Configuration management for humans.” (— Me, 2014) Uses SSH Secure, fast, simple Don't need configuration management to manage your configuration management.
  6. 6. Over 270 modules built-in Over 3,000 roles on Ansible Galaxy Extensible, modular APIs (JSON, language-agnostic)
  7. 7. Installation Mac: brew install ansible Python pip: sudo pip install ansible RHEL/CentOS: sudo yum install ansible Deb/Ubuntu: sudo apt-add-repository ppa:ansible/ansible
 sudo apt-get update
 sudo apt-get install ansible
  8. 8. Ansible 101 1. Inventory: Describe your infrastructure 2. Ad-Hoc commands: Run one-off tasks 3. Playbooks: "Infrastructure as code"
  9. 9. ________________________________________ / Drupal 8 on a cluster of Raspberry Pis #dramble / ---------------------------------------- ^__^ (oo)_______ (__) )/ ||----w | || ||
  10. 10. http://robmyers.org/cc-ironies/no_flash_photography_sign/ Please help me avoid the
 Xenon Death Flash
  11. 11. The #Dramble CPU 24 cores / 5.4 GHz RAM 6 GB Storage 96 GB microSD Network 10/100 over Gigabit network
  12. 12. Inventory Like a hosts file for Ansible (/etc/ansible/hosts) INI syntax [webservers] www1.pidramble.com www2.pidramble.com www3.pidramble.com
  13. 13. Inventory Like a hosts file for Ansible (/etc/ansible/hosts) INI syntax [webservers] www1.pidramble.com www2.pidramble.com www3.pidramble.com Group Servers in group
  14. 14. Ad-Hoc commands Test Ansible's connection with the ping module. $ ansible webservers -m ping
  15. 15. Ad-Hoc commands Test Ansible's connection with the ping module. $ ansible webservers -m ping Group Module
  16. 16. Ad-Hoc commands Have fun with RGB LEDs! $ ansible webservers -a "rgb red" -s
  17. 17. Ad-Hoc commands Have fun with RGB LEDs! $ ansible webservers -a "rgb red" -s Group 'Use sudo' Command
  18. 18. ________ < Shiny! > -------- ^__^ (oo)_______ (__) )/ ||----w | || ||
  19. 19. Ad-Hoc commands $ ansible webservers -a "sudo apt-get install php5-common"
  20. 20. Ad-Hoc commands $ ansible webservers -m apt -a "name=php5-common state=installed" -s Module Arguments
  21. 21. Playbooks Ad-Hoc commands don't solve the snowflake problem "infrastructure as code" Simple YAML files Run with: ansible-playbook Unique, by Pen Waggener
  22. 22. Playbooks --- - hosts: webservers sudo: yes tasks: - name: Ensure PHP is installed. apt: name=php5-common state=installed
  23. 23. Playbooks --- - hosts: webservers sudo: yes tasks: - name: Ensure PHP is installed. apt: name=php5-common state=installed Group Module Documentation Arguments
  24. 24. Playbooks Includes: include playbooks in other playbooks Variables: flexible - defaults and easy overrides Templates: use Jinja2 (Twig-like syntax!) Roles: encapsulate 'chunks' of configuration (like PHP classes)
  25. 25. Back to the #Dramble “Drupal 8 on a cluster of Raspberry Pis”
  26. 26. Architecture
  27. 27. Architecture
  28. 28. Architecture
  29. 29. Architecture
  30. 30. Architecture --- - hosts: database sudo: yes vars_files: - ../vars.yml - vars.yml roles: - geerlingguy.firewall - geerlingguy.mysql - geerlingguy.munin-node - ../roles/leds Fully functioning MySQL server in 13 lines of YAML!
  31. 31. Provisioning the Servers No live demo: "Never rely on Conference WiFi" But we can talk about it later :-)
  32. 32. Deploying Drupal 8 Demo See: raspberry-pi-dramble on GitHub
  33. 33. Deploying Drupal 8 1. First deploy: install $ ansible-playbook main.yml 2. Second deploy: update, import config, rebuild caches $ ansible-playbook main.yml --extra-vars "drupal_version=1.1.1" 3. Third deploy: enable Redis $ ansible-playbook main.yml --extra-vars "drupal_version=1.1.1 drupal_redis_enabled=true"
  34. 34. $ wrk -t4 -c100 -d20 http://pidramble.com/ Running 20s test @ http://pidramble.com/ 4 threads and 100 connections Thread Stats Avg Stdev Max +/- Stdev Latency 45.19ms 21.19ms 350.10ms 89.04% Req/Sec 555.98 43.24 804.00 92.67% 44183 requests in 20.00s, 222.31MB read Requests/sec: 2209.20 Transfer/sec: 11.12MB $ wrk -t4 -c24 -d20 http://pidramble.com/?nocache=true Running 20s test @ http://pidramble.com/?nocache=true 4 threads and 24 connections Thread Stats Avg Stdev Max +/- Stdev Latency 1.62s 240.73ms 2.16s 63.33% Req/Sec 3.10 0.61 4.00 63.33% 288 requests in 20.03s, 1.45MB read Socket errors: connect 0, read 0, write 0, timeout 10 Requests/sec: 14.38 Transfer/sec: 73.89KB Cached req/s: 2209.20 Uncached req/s: 14.38
  35. 35. ____________________________________ / Drupal 8 is scalable, but not fast ...yet. / ------------------------------------ ^__^ (oo)_______ (__) )/ ||----w | || ||
  36. 36. MORE DRAMBLE! Tons of benchmarks D8 performance and deployment discovery See the Raspberry Pi Dramble Wiki
  37. 37. MORE ANSIBLE! Docker integration AWS, DigitalOcean, Rackspace, Softlayer, Linode, etc. Notifications Rolling updates Ansible Vault Dynamic inventory etc...
  38. 38. Resources • Ansible documentation • Ansible Vagrant examples • Ansible for DevOps • Raspberry Pi Dramble
  39. 39. Feedback • https://joind.in/13825 • Speaker name: @geerlingguy • #MidCamp • #Dramble 50% off Ansible or DevOps: http://bit.ly/midcamp-a4d

×