Development 
with Ansible & VMs
Development with Ansible & VMs 
OUTLINE 
1. BETTER DEV 
2. ENVIRONMENT TOOLS 
3. CONFIG TOOLS 
4. WRAP-UP
Development with Ansible & VMs 
1. BETTER DEV 
2. ENVIRONMENT TOOLS 
3. CONFIG TOOLS 
4. WRAP-UP
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like 
• Your tools
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like 
• Your tools 
• Shareable
Development with Ansible & VMs 
1. BETTER DEV 
2. ENVIRONMENT TOOLS 
3. CONFIG TOOLS 
4. WRAP-UP
Development with Ansible & VMs 
PIP 
• Installs Python packages
Development with Ansible & VMs 
PIP 
• Installs Python packages 
• Keep using it!
Development with Ansible & VMs 
VIRTUALENV 
• Isolates Python packages
Development with Ansible & VMs 
VIRTUALENV 
• Isolates Python packages 
• Doesn’t go far enough…
Development with Ansible & VMs 
VM 
• Isolates entire box
Development with Ansible & VMs 
VM 
• Isolates entire box 
• Python packages
Development with Ansible & VMs 
VM 
• Isolates entire box 
• Python packages 
• System packages
Development with Ansible & VMs 
VM 
• Isolates entire box 
• Python packages 
• System packages 
• Production-like
Development with Ansible & VMs 
VM SETUP
Development with Ansible & VMs 
VM SETUP 
$ vagrant init hashicorp/precise64! 
$ vagrant up! 
$ vagrant ssh
Development with Ansible & VMs 
VM SETUP 
Vagrant::configure("2") do |config|! 
config.vm.box = "hashicorp/precise64"! 
config.vm.hostname = "chewse"! 
config.vm.network "private_network", ip: "10.0.0.100"! 
! 
config.vm.provision "ansible" do |ansible|! 
ansible.playbook = "ansible/chewse.yml"! 
end! 
end!
Development with Ansible & VMs 
VM SETUP 
Vagrant::configure("2") do |config|! 
config.vm.box = "hashicorp/precise64"! 
config.vm.hostname = "chewse"! 
config.vm.network "private_network", ip: "10.0.0.100"! 
! 
config.vm.provision "ansible" do |ansible|! 
ansible.playbook = "ansible/chewse.yml"! 
end! 
end!
Development with Ansible & VMs 
VM SETUP 
Vagrant::configure("2") do |config|! 
config.vm.box = "hashicorp/precise64"! 
config.vm.hostname = "chewse"! 
config.vm.network "private_network", ip: "10.0.0.100"! 
! 
config.vm.provision "ansible" do |ansible|! 
ansible.playbook = "ansible/chewse.yml"! 
end! 
end!
Development with Ansible & VMs 
VM SETUP 
Vagrant::configure("2") do |config|! 
config.vm.box = "hashicorp/precise64"! 
config.vm.hostname = "chewse"! 
config.vm.network "private_network", ip: "10.0.0.100"! 
! 
config.vm.provision "ansible" do |ansible|! 
ansible.playbook = "ansible/chewse.yml"! 
end! 
end!
Development with Ansible & VMs 
VM SETUP 
Vagrant::configure("2") do |config|! 
config.vm.box = "hashicorp/precise64"! 
config.vm.hostname = "chewse"! 
config.vm.network "private_network", ip: "10.0.0.100"! 
! 
config.vm.provision "ansible" do |ansible|! 
ansible.playbook = "ansible/chewse.yml"! 
end! 
end!
Development with Ansible & VMs 
1. BETTER DEV 
2. ENVIRONMENT TOOLS 
3. CONFIG TOOLS 
4. WRAP-UP
Development with Ansible & VMs 
CONFIGURATION 
• Defines system setup
Development with Ansible & VMs 
CONFIGURATION 
• Defines system setup 
• Written in code
Development with Ansible & VMs 
CONFIGURATION 
• Defines system setup 
• Written in code 
• Documented and versioned
Development with Ansible & VMs 
CONFIGURATION 
• Defines system setup 
• Written in code 
• Documented and versioned 
• Shareable
Development with Ansible & VMs 
CONFIGURATION SETUP 
bash
Development with Ansible & VMs 
CONFIGURATION SETUP 
bash
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes! 
! 
- name: bootstrap pip and virtualenv! 
pip: name={{ item.name }} version={{ item.version }}! 
with_items:! 
- { name: pip, version: 1.4.1 }! 
- { name: virtualenv, version: 1.10.1 }! 
sudo: yes! 
! 
- name: install requirements.txt! 
pip: requirements=/vagrant/requirements.txt virtualenv=/var/venv! 
sudo: yes! 
! 
- name: source virtualenv in .bashrc! 
lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! 
with_items:! 
- source /var/venv/bin/activate! 
- cd /vagrant/chewse!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
...! 
! 
- name: bootstrap pip and virtualenv! 
...! 
! 
- name: install requirements.txt! 
...! 
! 
- name: source virtualenv in .bashrc! 
...
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: bootstrap pip and virtualenv! 
pip: name={{ item.name }} version={{ item.version }}! 
with_items:! 
- { name: pip, version: 1.4.1 }! 
- { name: virtualenv, version: 1.10.1 }! 
sudo: yes!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: bootstrap pip and virtualenv! 
pip: name={{ item.name }} version={{ item.version }}! 
with_items:! 
- { name: pip, version: 1.4.1 }! 
- { name: virtualenv, version: 1.10.1 }! 
sudo: yes!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: bootstrap pip and virtualenv! 
pip: name={{ item.name }} version={{ item.version }}! 
with_items:! 
- { name: pip, version: 1.4.1 }! 
- { name: virtualenv, version: 1.10.1 }! 
sudo: yes!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: install requirements.txt! 
pip: requirements=/vagrant/requirements.txt ! 
virtualenv=/var/venv! 
sudo: yes!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: install requirements.txt! 
pip: requirements=/vagrant/requirements.txt ! 
virtualenv=/var/venv! 
sudo: yes!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: source virtualenv in .bashrc! 
lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! 
with_items:! 
- source /var/venv/bin/activate! 
- cd /vagrant/chewse!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: source virtualenv in .bashrc! 
lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! 
with_items:! 
- source /var/venv/bin/activate! 
- cd /vagrant/chewse!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: source virtualenv in .bashrc! 
lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! 
with_items:! 
- source /var/venv/bin/activate! 
- cd /vagrant/chewse!
Development with Ansible & VMs 
CONFIGURATION SETUP 
- name: standard python system packages! 
apt: pkg={{ item }} state=installed! 
with_items:! 
- python! 
- python-dev! 
- python-pip! 
- libxml2-dev! 
- libxslt1-dev! 
sudo: yes! 
! 
- name: bootstrap pip and virtualenv! 
pip: name={{ item.name }} version={{ item.version }}! 
with_items:! 
- { name: pip, version: 1.4.1 }! 
- { name: virtualenv, version: 1.10.1 }! 
sudo: yes! 
! 
- name: install requirements.txt! 
pip: requirements=/vagrant/requirements.txt virtualenv=/var/venv! 
sudo: yes! 
! 
- name: source virtualenv in .bashrc! 
lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! 
with_items:! 
- source /var/venv/bin/activate! 
- cd /vagrant/chewse!
Development with Ansible & VMs 
1. BETTER DEV 
2. ENVIRONMENT TOOLS 
3. CONFIG TOOLS 
4. WRAP-UP
Development with Ansible & VMs 
OUR INSTALL 
• Install VirtualBox and Vagrant
Development with Ansible & VMs 
OUR INSTALL 
• Install VirtualBox and Vagrant 
• Git clone chewse
Development with Ansible & VMs 
OUR INSTALL 
• Install VirtualBox and Vagrant 
• Git clone chewse 
• Vagrant up
Development with Ansible & VMs 
OUR INSTALL 
• Install VirtualBox and Vagrant 
• Git clone chewse 
• Vagrant up 
• Dev nirvana
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like 
• Your tools
Development with Ansible & VMs 
DEV WISH LIST 
• Standardized 
• Repeatable 
• Isolated 
• Production-like 
• Your tools 
• Shareable
Development with Ansible & VMs 
Jeff Schenck CTO & Co-Founder 
twitter: @jeffschenck 
! 
www.chewse.com

Development with Ansible & VMs

  • 1.
  • 2.
    Development with Ansible& VMs OUTLINE 1. BETTER DEV 2. ENVIRONMENT TOOLS 3. CONFIG TOOLS 4. WRAP-UP
  • 3.
    Development with Ansible& VMs 1. BETTER DEV 2. ENVIRONMENT TOOLS 3. CONFIG TOOLS 4. WRAP-UP
  • 4.
    Development with Ansible& VMs DEV WISH LIST • Standardized
  • 5.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable
  • 6.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated
  • 7.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like
  • 8.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like • Your tools
  • 9.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like • Your tools • Shareable
  • 10.
    Development with Ansible& VMs 1. BETTER DEV 2. ENVIRONMENT TOOLS 3. CONFIG TOOLS 4. WRAP-UP
  • 11.
    Development with Ansible& VMs PIP • Installs Python packages
  • 12.
    Development with Ansible& VMs PIP • Installs Python packages • Keep using it!
  • 13.
    Development with Ansible& VMs VIRTUALENV • Isolates Python packages
  • 14.
    Development with Ansible& VMs VIRTUALENV • Isolates Python packages • Doesn’t go far enough…
  • 15.
    Development with Ansible& VMs VM • Isolates entire box
  • 16.
    Development with Ansible& VMs VM • Isolates entire box • Python packages
  • 17.
    Development with Ansible& VMs VM • Isolates entire box • Python packages • System packages
  • 18.
    Development with Ansible& VMs VM • Isolates entire box • Python packages • System packages • Production-like
  • 19.
  • 20.
    Development with Ansible& VMs VM SETUP $ vagrant init hashicorp/precise64! $ vagrant up! $ vagrant ssh
  • 21.
    Development with Ansible& VMs VM SETUP Vagrant::configure("2") do |config|! config.vm.box = "hashicorp/precise64"! config.vm.hostname = "chewse"! config.vm.network "private_network", ip: "10.0.0.100"! ! config.vm.provision "ansible" do |ansible|! ansible.playbook = "ansible/chewse.yml"! end! end!
  • 22.
    Development with Ansible& VMs VM SETUP Vagrant::configure("2") do |config|! config.vm.box = "hashicorp/precise64"! config.vm.hostname = "chewse"! config.vm.network "private_network", ip: "10.0.0.100"! ! config.vm.provision "ansible" do |ansible|! ansible.playbook = "ansible/chewse.yml"! end! end!
  • 23.
    Development with Ansible& VMs VM SETUP Vagrant::configure("2") do |config|! config.vm.box = "hashicorp/precise64"! config.vm.hostname = "chewse"! config.vm.network "private_network", ip: "10.0.0.100"! ! config.vm.provision "ansible" do |ansible|! ansible.playbook = "ansible/chewse.yml"! end! end!
  • 24.
    Development with Ansible& VMs VM SETUP Vagrant::configure("2") do |config|! config.vm.box = "hashicorp/precise64"! config.vm.hostname = "chewse"! config.vm.network "private_network", ip: "10.0.0.100"! ! config.vm.provision "ansible" do |ansible|! ansible.playbook = "ansible/chewse.yml"! end! end!
  • 25.
    Development with Ansible& VMs VM SETUP Vagrant::configure("2") do |config|! config.vm.box = "hashicorp/precise64"! config.vm.hostname = "chewse"! config.vm.network "private_network", ip: "10.0.0.100"! ! config.vm.provision "ansible" do |ansible|! ansible.playbook = "ansible/chewse.yml"! end! end!
  • 26.
    Development with Ansible& VMs 1. BETTER DEV 2. ENVIRONMENT TOOLS 3. CONFIG TOOLS 4. WRAP-UP
  • 27.
    Development with Ansible& VMs CONFIGURATION • Defines system setup
  • 28.
    Development with Ansible& VMs CONFIGURATION • Defines system setup • Written in code
  • 29.
    Development with Ansible& VMs CONFIGURATION • Defines system setup • Written in code • Documented and versioned
  • 30.
    Development with Ansible& VMs CONFIGURATION • Defines system setup • Written in code • Documented and versioned • Shareable
  • 31.
    Development with Ansible& VMs CONFIGURATION SETUP bash
  • 32.
    Development with Ansible& VMs CONFIGURATION SETUP bash
  • 33.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes! ! - name: bootstrap pip and virtualenv! pip: name={{ item.name }} version={{ item.version }}! with_items:! - { name: pip, version: 1.4.1 }! - { name: virtualenv, version: 1.10.1 }! sudo: yes! ! - name: install requirements.txt! pip: requirements=/vagrant/requirements.txt virtualenv=/var/venv! sudo: yes! ! - name: source virtualenv in .bashrc! lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! with_items:! - source /var/venv/bin/activate! - cd /vagrant/chewse!
  • 34.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! ...! ! - name: bootstrap pip and virtualenv! ...! ! - name: install requirements.txt! ...! ! - name: source virtualenv in .bashrc! ...
  • 35.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes
  • 36.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes
  • 37.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes
  • 38.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes
  • 39.
    Development with Ansible& VMs CONFIGURATION SETUP - name: bootstrap pip and virtualenv! pip: name={{ item.name }} version={{ item.version }}! with_items:! - { name: pip, version: 1.4.1 }! - { name: virtualenv, version: 1.10.1 }! sudo: yes!
  • 40.
    Development with Ansible& VMs CONFIGURATION SETUP - name: bootstrap pip and virtualenv! pip: name={{ item.name }} version={{ item.version }}! with_items:! - { name: pip, version: 1.4.1 }! - { name: virtualenv, version: 1.10.1 }! sudo: yes!
  • 41.
    Development with Ansible& VMs CONFIGURATION SETUP - name: bootstrap pip and virtualenv! pip: name={{ item.name }} version={{ item.version }}! with_items:! - { name: pip, version: 1.4.1 }! - { name: virtualenv, version: 1.10.1 }! sudo: yes!
  • 42.
    Development with Ansible& VMs CONFIGURATION SETUP - name: install requirements.txt! pip: requirements=/vagrant/requirements.txt ! virtualenv=/var/venv! sudo: yes!
  • 43.
    Development with Ansible& VMs CONFIGURATION SETUP - name: install requirements.txt! pip: requirements=/vagrant/requirements.txt ! virtualenv=/var/venv! sudo: yes!
  • 44.
    Development with Ansible& VMs CONFIGURATION SETUP - name: source virtualenv in .bashrc! lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! with_items:! - source /var/venv/bin/activate! - cd /vagrant/chewse!
  • 45.
    Development with Ansible& VMs CONFIGURATION SETUP - name: source virtualenv in .bashrc! lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! with_items:! - source /var/venv/bin/activate! - cd /vagrant/chewse!
  • 46.
    Development with Ansible& VMs CONFIGURATION SETUP - name: source virtualenv in .bashrc! lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! with_items:! - source /var/venv/bin/activate! - cd /vagrant/chewse!
  • 47.
    Development with Ansible& VMs CONFIGURATION SETUP - name: standard python system packages! apt: pkg={{ item }} state=installed! with_items:! - python! - python-dev! - python-pip! - libxml2-dev! - libxslt1-dev! sudo: yes! ! - name: bootstrap pip and virtualenv! pip: name={{ item.name }} version={{ item.version }}! with_items:! - { name: pip, version: 1.4.1 }! - { name: virtualenv, version: 1.10.1 }! sudo: yes! ! - name: install requirements.txt! pip: requirements=/vagrant/requirements.txt virtualenv=/var/venv! sudo: yes! ! - name: source virtualenv in .bashrc! lineinfile: dest=/home/vagrant/.bashrc line="{{ item }}"! with_items:! - source /var/venv/bin/activate! - cd /vagrant/chewse!
  • 48.
    Development with Ansible& VMs 1. BETTER DEV 2. ENVIRONMENT TOOLS 3. CONFIG TOOLS 4. WRAP-UP
  • 49.
    Development with Ansible& VMs OUR INSTALL • Install VirtualBox and Vagrant
  • 50.
    Development with Ansible& VMs OUR INSTALL • Install VirtualBox and Vagrant • Git clone chewse
  • 51.
    Development with Ansible& VMs OUR INSTALL • Install VirtualBox and Vagrant • Git clone chewse • Vagrant up
  • 52.
    Development with Ansible& VMs OUR INSTALL • Install VirtualBox and Vagrant • Git clone chewse • Vagrant up • Dev nirvana
  • 53.
    Development with Ansible& VMs DEV WISH LIST • Standardized
  • 54.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable
  • 55.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated
  • 56.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like
  • 57.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like • Your tools
  • 58.
    Development with Ansible& VMs DEV WISH LIST • Standardized • Repeatable • Isolated • Production-like • Your tools • Shareable
  • 59.
    Development with Ansible& VMs Jeff Schenck CTO & Co-Founder twitter: @jeffschenck ! www.chewse.com