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.

Application Deployment Using Ansible

25,738 views

Published on

Delivered at Sensis brown bag session - August 2013.

Application Deployment Using Ansible

  1. 1. APPLICATION DEPLOYMENT USING ANSIBLE Cliffano Subagio | @cliffano | Sensis
  2. 2. /me > Continuous Integration/Deployment/Delivery > Most important lesson: Never ever write a deployment framework in Ant!
  3. 3. /project > Micro-services architecture > 15 applications > 2 data centers > 2 x 10 app servers > 2 x 3 db servers > Hundreds of deployments to date
  4. 4. ansible > Orchestration + automation engine > Application deployment > System provisioning
  5. 5. why ansible > Push via SSH > No agents on remote systems > Readable playbook > Tasks executed in order > Built-in + custom modules > Community growth
  6. 6. sample usage ansible-playbook --inventory-file=hosts.ini --module-path=path/to/custom-modules --extra-vars=”ENV=testVERSION=1.2.3” --tags ci -u username --verbose app-playbook.yml
  7. 7. sample inventory file [foo-dev] devhost1.some.domain.com [foo-test] testhost1.some.domain.com testhost2.some.domain.com [bar-test] testhost1.some.domain.com
  8. 8. sample playbook - hosts: foo-$ENV vars: BASE=/app/ tasks: - name: Send artifact file to remote system copy: src=foo-$VERSION.tar.gz dest=$BASE/builds tags: - ci
  9. 9. separation of concerns > Playbook defines how to deploy an app > Inventory file defines where to deploy those apps
  10. 10. artifacts app1 playbook.yml app2 playbook.yml app3 playbook.yml app4 playbook.yml app5 playbook.yml app6 playbook.yml project inventoryfile package.json > Avoid monolithic deployment configuration
  11. 11. deployment flow artifact-repo app6-0.0.3.tar.gz jenkins deploy- server dev source-repo test stage prod release-repo project-2.3.4.tar.gz
  12. 12. custom module > Usage: cleanbuilds dir=/app/foo/builds/ keep=5 > Keeps the last N builds > Controls disk usage > Written in python
  13. 13. gnu parallel > Improve deployment time > (echo app1 && echo app2) | parallel ansible-playbook ... > Grouping and ordering of stdout & stderr > Optimised to available CPU cores
  14. 14. what’s next > Write more common Ansible modules > ControlMaster, 0mq > AnsibleWorks AWX
  15. 15. AWX
  16. 16. conclusions > Ansible really works (no pun intended) > Modules encourage reusability > I’m not writing a deployment framework > Collaboration between dev, devops, ops teams
  17. 17. questions + discussion
  18. 18. slide notes > http://www.ansibleworks.com/ > http://www.ansibleworks.com/docs/modules.html > http://jpmens.net/2012/10/01/dramatically-speeding-up-ansible-runs/ > http://www.gnu.org/software/parallel > http://ant.apache.org > http://jenkins-ci.org

×