SlideShare a Scribd company logo
Vagrant & Ansible 
for local dev and production 
deployment 
Christoffer Kaalund : Everplaces 
@ChrisKaalund
= Local development tool
• Super simple to setup dev env 
• Fully reproducible 
• Having a setup that is as close to prod as possible 
• Works with Chef, Puppet, Ansible & Shell Scripts to 
provision your dev env
Vagrant, VirtualBox, Ansible
Application deployment 
& 
Configuration Management
• Agentless - push not pull 
• Simple to setup, read and understand 
• Wildly powerful 
• Easy to extent 
• Python
ansible-playbook -i production webserver.yml
WHERE 
staging 
dev 
ansible-playbook -i production webserver.yml
WHAT 
database.yml 
site.yml (all) 
ansible-playbook -i production webserver.yml
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
site.yml 
deploy.yml 
roles/ 
database/ 
tasks/ 
main.yml 
handlers/ 
main.yml 
files/ 
foo.txt 
templates/ 
bar.j2 
vars/ 
main.yml 
web/ 
... 
memcached/ 
...
Inventories 
Playbooks 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
site.yml 
deploy.yml 
roles/ 
database/ 
tasks/ 
main.yml 
handlers/ 
main.yml 
files/ 
foo.txt 
templates/ 
bar.j2 
vars/ 
main.yml 
web/ 
... 
memcached/ 
...
Inventories 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
# file: inventories/production 
[web] 
4.2.2.1 
4.2.2.2 
[database] 
8.8.8.8 
[production:children] 
web 
database
Inventories 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
# file: inventories/production 
[web] 
4.2.2.1 
4.2.2.2 
[database] 
8.8.8.8 
[production:children] 
web 
database 
# file: inventories/dev 
[web] 
192.168.33.16 
[database] 
192.168.33.16 
[dev:children] 
web 
database
Inventories 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
# file: inventories/production 
[web] 
Group 
4.2.2.1 
4.2.2.2 
[database] 
8.8.8.8 
[production:children] 
web 
database
Inventories 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
# file: inventories/production 
[web] 
Group 
4.2.2.1 
Host 
4.2.2.2 
[database] 
8.8.8.8 
[production:children] 
web 
database
Inventories > variables 
inventories/ 
dev 
production 
group_vars/ 
all/ 
main.yml 
keys.yml 
database 
dev 
production 
host_vars/ 
... 
--- 
# file: group_vars/database 
db_name: "{{ project_name }}_db" 
db_user: "{{ project_name }}_pg" 
db_encoding: UTF8 
db_collate_and_ctype: en_US.UTF-8 
db_template: template0 
# file: inventories/production 
[web] 
4.2.2.1 
4.2.2.2 
[database] 
8.8.8.8 
[production:children] 
web 
database
ansible-playbook -i inventories/production site.yml
Playbooks 
Playbooks = a list of plays
Playbooks 
A play = running tasks on hosts
Playbooks 
- hosts: web 
tasks: 
- name: Ensure apache is at the latest version 
yum: pkg=httpd state=latest 
- name: Ensure apache is running 
service: name=httpd state=started
Playbooks 
Roles = groups of tasks
Playbooks 
# file: site.yml 
--- 
- hosts: database 
sudo: yes 
sudo_user: root 
roles: 
- database 
- hosts: web 
sudo: yes 
sudo_user: root 
roles: 
- memcached 
- webserver 
deploy.yml 
site.yml 
roles/ 
database/ 
tasks/ 
main.yml 
handlers/ 
main.yml 
files/ 
foo.txt 
templates/ 
bar.j2 
vars/ 
main.yml 
web/ 
... 
memcached/ 
...
ansible-playbook -i inventories/production site.yml
Playbooks > Roles 
roles/ 
database/ 
tasks/ 
main.yml 
handlers/ 
main.yml 
files/ 
foo.txt 
templates/ 
bar.j2 
vars/ 
main.yml
Inventory Playbooks 
Groups 
Hosts 
Roles 
Tasks 
Modules

More Related Content

What's hot

Building Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenvBuilding Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenv
Yuya Takeyama
 
Using Backbone.js with Drupal 7 and 8
Using Backbone.js with Drupal 7 and 8Using Backbone.js with Drupal 7 and 8
Using Backbone.js with Drupal 7 and 8
Ovadiah Myrgorod
 

What's hot (13)

Using multi-tenant WordPress to simplify development
Using multi-tenant WordPress to simplify developmentUsing multi-tenant WordPress to simplify development
Using multi-tenant WordPress to simplify development
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappersDrupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
 
Building Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenvBuilding Development Environment with php-build and phpenv
Building Development Environment with php-build and phpenv
 
How to Contribute Code to MySQL?
How to Contribute Code to MySQL?How to Contribute Code to MySQL?
How to Contribute Code to MySQL?
 
Introducing Wordpress Multitenancy
Introducing Wordpress MultitenancyIntroducing Wordpress Multitenancy
Introducing Wordpress Multitenancy
 
Die .htaccess richtig nutzen
Die .htaccess richtig nutzenDie .htaccess richtig nutzen
Die .htaccess richtig nutzen
 
A modern front end development workflow for Magnolia at Atlassian
A modern front end development workflow for Magnolia at AtlassianA modern front end development workflow for Magnolia at Atlassian
A modern front end development workflow for Magnolia at Atlassian
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
 
What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppet
 
HTTPS + Let's Encrypt
HTTPS + Let's EncryptHTTPS + Let's Encrypt
HTTPS + Let's Encrypt
 
Using Backbone.js with Drupal 7 and 8
Using Backbone.js with Drupal 7 and 8Using Backbone.js with Drupal 7 and 8
Using Backbone.js with Drupal 7 and 8
 
Week3 adb
Week3 adbWeek3 adb
Week3 adb
 

Viewers also liked

Using puppet, foreman and git to develop and operate a large scale internet s...
Using puppet, foreman and git to develop and operate a large scale internet s...Using puppet, foreman and git to develop and operate a large scale internet s...
Using puppet, foreman and git to develop and operate a large scale internet s...
techblog
 
Orchestration with Ansible at Fedora Project
Orchestration with Ansible at Fedora ProjectOrchestration with Ansible at Fedora Project
Orchestration with Ansible at Fedora Project
Aditya Patawari
 

Viewers also liked (20)

Vagrant
VagrantVagrant
Vagrant
 
RightScale Webinar: Successfully Deploy Your Windows Workloads
RightScale Webinar: Successfully Deploy Your Windows WorkloadsRightScale Webinar: Successfully Deploy Your Windows Workloads
RightScale Webinar: Successfully Deploy Your Windows Workloads
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...
 
Ansible overview
Ansible overviewAnsible overview
Ansible overview
 
Vagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easyVagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easy
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Vagrant - Concept
Vagrant - ConceptVagrant - Concept
Vagrant - Concept
 
Simple flexible deployments with openstack ansible
Simple flexible deployments with openstack ansibleSimple flexible deployments with openstack ansible
Simple flexible deployments with openstack ansible
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Vagrant
VagrantVagrant
Vagrant
 
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
An Integrated Pipeline for Private and Public Clouds with Jenkins, Artifactor...
 
Using puppet, foreman and git to develop and operate a large scale internet s...
Using puppet, foreman and git to develop and operate a large scale internet s...Using puppet, foreman and git to develop and operate a large scale internet s...
Using puppet, foreman and git to develop and operate a large scale internet s...
 
Scalable systems management with puppet
Scalable systems management with puppetScalable systems management with puppet
Scalable systems management with puppet
 
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do ItChef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
 
Orchestration with Ansible at Fedora Project
Orchestration with Ansible at Fedora ProjectOrchestration with Ansible at Fedora Project
Orchestration with Ansible at Fedora Project
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 
Automatic Configuration of Your Cloud with Puppet
Automatic Configuration of Your Cloud with PuppetAutomatic Configuration of Your Cloud with Puppet
Automatic Configuration of Your Cloud with Puppet
 

Similar to Vagrant and ansible

IzPack at LyonJUG'11
IzPack at LyonJUG'11IzPack at LyonJUG'11
IzPack at LyonJUG'11
julien.ponge
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
Dave Barcelo
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 

Similar to Vagrant and ansible (20)

Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our Wishbone
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
IzPack at LyonJUG'11
IzPack at LyonJUG'11IzPack at LyonJUG'11
IzPack at LyonJUG'11
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
AWS ElasticBeanstalk Advanced configuration
AWS ElasticBeanstalk Advanced configurationAWS ElasticBeanstalk Advanced configuration
AWS ElasticBeanstalk Advanced configuration
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.js
 
Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLA
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 

Recently uploaded

Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
Kamal Acharya
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 

Vagrant and ansible

  • 1. Vagrant & Ansible for local dev and production deployment Christoffer Kaalund : Everplaces @ChrisKaalund
  • 2.
  • 4. • Super simple to setup dev env • Fully reproducible • Having a setup that is as close to prod as possible • Works with Chef, Puppet, Ansible & Shell Scripts to provision your dev env
  • 6.
  • 7. Application deployment & Configuration Management
  • 8. • Agentless - push not pull • Simple to setup, read and understand • Wildly powerful • Easy to extent • Python
  • 10. WHERE staging dev ansible-playbook -i production webserver.yml
  • 11. WHAT database.yml site.yml (all) ansible-playbook -i production webserver.yml
  • 12. inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... site.yml deploy.yml roles/ database/ tasks/ main.yml handlers/ main.yml files/ foo.txt templates/ bar.j2 vars/ main.yml web/ ... memcached/ ...
  • 13. Inventories Playbooks inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... site.yml deploy.yml roles/ database/ tasks/ main.yml handlers/ main.yml files/ foo.txt templates/ bar.j2 vars/ main.yml web/ ... memcached/ ...
  • 14. Inventories inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... # file: inventories/production [web] 4.2.2.1 4.2.2.2 [database] 8.8.8.8 [production:children] web database
  • 15. Inventories inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... # file: inventories/production [web] 4.2.2.1 4.2.2.2 [database] 8.8.8.8 [production:children] web database # file: inventories/dev [web] 192.168.33.16 [database] 192.168.33.16 [dev:children] web database
  • 16. Inventories inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... # file: inventories/production [web] Group 4.2.2.1 4.2.2.2 [database] 8.8.8.8 [production:children] web database
  • 17. Inventories inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... # file: inventories/production [web] Group 4.2.2.1 Host 4.2.2.2 [database] 8.8.8.8 [production:children] web database
  • 18. Inventories > variables inventories/ dev production group_vars/ all/ main.yml keys.yml database dev production host_vars/ ... --- # file: group_vars/database db_name: "{{ project_name }}_db" db_user: "{{ project_name }}_pg" db_encoding: UTF8 db_collate_and_ctype: en_US.UTF-8 db_template: template0 # file: inventories/production [web] 4.2.2.1 4.2.2.2 [database] 8.8.8.8 [production:children] web database
  • 20. Playbooks Playbooks = a list of plays
  • 21. Playbooks A play = running tasks on hosts
  • 22. Playbooks - hosts: web tasks: - name: Ensure apache is at the latest version yum: pkg=httpd state=latest - name: Ensure apache is running service: name=httpd state=started
  • 23. Playbooks Roles = groups of tasks
  • 24. Playbooks # file: site.yml --- - hosts: database sudo: yes sudo_user: root roles: - database - hosts: web sudo: yes sudo_user: root roles: - memcached - webserver deploy.yml site.yml roles/ database/ tasks/ main.yml handlers/ main.yml files/ foo.txt templates/ bar.j2 vars/ main.yml web/ ... memcached/ ...
  • 26. Playbooks > Roles roles/ database/ tasks/ main.yml handlers/ main.yml files/ foo.txt templates/ bar.j2 vars/ main.yml
  • 27. Inventory Playbooks Groups Hosts Roles Tasks Modules