![Page 1: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/1.jpg)
DevOps: What is it and why is it important?
Mark Stillwell
September 28, 2014
![Page 2: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/2.jpg)
Traditional Development/Deployment best practices
I source code only in vcs
I static release as versioned archive
I unit testing of code in development environment
I final product not installed on developer machine
I deployment instructions via howto or interactive application
I time consumingI difficult to replicate
![Page 3: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/3.jpg)
Similar Workflows
I Collaborating on a paper by emailing Word .doc filesI Developing software without vcs, periodically creating
versioned/dated zip file in a backup/ directory
![Page 4: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/4.jpg)
Issues With These Approaches
I Coordination, Communication, Documentation:
I “I’ll edit the document and email you when I’m done.”I “I had to tinker with /etc/foo to get things working.”
I Handling of conflicts
I No automating of merges
I Lack of one true authoritative “latest version”.I Culture of Fear
I “I know generally what needs to be done, but I’m afraid to trybecause I might break it and not be able to get things workingagain.”
![Page 5: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/5.jpg)
Software Specific Issues
I Difficulty verifying complicated interaction between multipleparts.
I “Brittle” deployment: It works, mostly, but don’t touch it!I Experts-Only install discourages end-users, results in lower
adoption/mindshare.
![Page 6: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/6.jpg)
DevOps
I deployment as code in vcsI continuously testedI test environment similar to deployment environment
I enabled by virtual machines and containers
I regular deployments to productionI industry standard practice!
I NetFlix, Etsy, Twitter, etc tear down infrastructure andredeploy multiple times per day. . .
I culture of fearless development
![Page 7: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/7.jpg)
Enabling Technologies
I ansibleI vagrantI docker
![Page 8: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/8.jpg)
Ansible
I tool for managing distributed software deploymentsI similar tools: puppet, chef, salt, cfengineI free software (for command line, commercial web-based
management interface)I written in pythonI configuration as list of “idempotent” tasks in yaml based
configuration
I really only pseudo-idempotent
I push model that only requires administrator’s computer haveansible software and client machines have sshd and python
I all other require some kind of bootstrapping process on clientsI some (e.g., puppet) require server setup
![Page 9: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/9.jpg)
Example Playbook
- hosts: all
sudo: True
tasks:
- name: ensure sysctl is configured
sysctl:
name: vm.swappiness
value: 10
state: present
- name: ensure latest version is installed
apt:
pkg: etckeeper
state: latest
![Page 10: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/10.jpg)
Vagrant
I command line wrapper to virtualisation tools likevirtualbox/kvm
I sets up disks / networking etc.I all configuration in text VagrantfileI can bring up and network multiple vms with different
operating systemsI can invoke provisioning tools like ansible, or shell scriptsI user just needs to cd to right directory, type “vagrant up”
![Page 11: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/11.jpg)
Example Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty"
config.vm.network "forwarded_port", guest: 80, host: 80
config.vm.provider "virtualbox" do |v|
v.memory = 1280
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "site.yml"
end
end
![Page 12: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/12.jpg)
Docker
I interface for managing “container” based deployments
I light-weight environment virtualisation that makes use oflinux-kernel features
I “like chroot on steroids”I currently uses lxc, but this may change in the future
I also manages “layered” file sytems using aufs copy-on-write
I disk-space efficientI docker.io has a repository of of layers, e.g. “docker pull
ubuntu”
I can be used to provide “lightweight linux virtual machines”,but this isn’t the most efficient approach
I no need to run multiple copies of system servicesI preference is one process per container, “single responsibility
principle”I inter-process communication enabled by mapping directories /
ports between containers and/or host
![Page 13: DevOps introduction with ansible, vagrant, and docker](https://reader037.vdocuments.site/reader037/viewer/2022100506/5563164bd8b42a51498b4e67/html5/thumbnails/13.jpg)
Websites
I http://ansible.comI http://vagrantup.comI http://docker.io