DevOps
Vagrant & Ansible
Why ?
Code As Infrastructure
Because luck has no place
WHY ?
Installing development environment –
no worries
Prevent your computer from being
ruined
Team efficiency
Remove the pain of software
deployment
Prevents inadvertent errors
Avoids annoying tasks
It works on my machine !
Certification program
• Compile your application code. Getting the latest version of
any recent code changes from other developers is purely
optional and not a requirement for certification.
• Launch the application or website that has just been
compiled.
• Cause one code path in the code you're checking in to be
executed. The preferred way to do this is with ad-hoc
manual testing of the simplest possible case for the feature
in question. Omit this step if the code change was less than
five lines, or if, in the developer's professional opinion, the
code change could not possibly result in an error.
• Check the code changes into your version control system.
http://blog.codinghorror.com/the-works-on-my-machine-certification-program/
HOW ?
Know State & Consistency
State A
Provisioning
State B
Idempotence & Repeatability
State B
Provisioning
State B
Now you should say
Meet the tools
a very opinionated presentation
The VM manager
Vagrant
The provisioning tool
• It configures the machine (installs stuff, push
config files, etc.)
– Puppet
– Chef
– Ansible
– Salt
– … ?
The deployment tool
• It pushes the project on the server (&
configures it, runs migration, clears caches, …)
– Capistrano (and it can deploy non ruby
applications)
– Two ways informations transferts (DB sync, logs…)
Summary
VMmanagement
Vagrant
Systemconfiguration
Ansible
Applicationdeployment
Capistrano
Where is Docker ?
Well…Pre-provisionedVM
Docker
Applicationdeployment
Capistrano
Why we don’t use docker ?
• Because you need a specific cloud provider…
And we deploy our apps in the customer
datacenter on various systems.
• But maybe, one day…
So why Ansible and not
puppet/chef/… ?
• Simple (its just Yaml)
• Agent less
• Runs on every dev machine (python +
openssh, yeah that means you don’t need
ruby)
• Push based
• Made in Durham
How it works ?
Vagrant
• A Vagrant File contains :
– Provider
– Sharing folder instruction
– Networking configuration (port forwarding)
– (optionnal) Provisionner
Ansible
• Hosts
• Variables
• Roles
Playbook.yml
Rôles
Rôles (again)
Tasks
Templates
Handlers
Files
• It’s just for copy/paste !
Vagrant + ansible skeleton
• https://github.com/Ibsciss/vagrant-ansible-php
Where do I put all of this stuff ?
in its own branch
Does & Don’ts
It’s also opinionated
• Don’t: Make snowflake VM : you become
dependant of the VM management tool
• Do: Separate provisioning
• Don’t: Use Vagrant default SSH key in
production !
• Don’t: Separate dev & ops
• Don’t: Try to eliminate admin sys (you need
hero)
• Do: Use same environment for Dev/test/prod
Let’s deploy !
Questions ?
Thank you !

DevOps, A brief introduction to Vagrant & Ansible

Editor's Notes

  • #9 If its broken something, you repair once the others members can just update the env
  • #29 We use Capistrano, so you finally we have to use Ruby