Vagrant & Ansible

for hermits like me and you?

Dev-VM

  • Install OS into a virtual machine and snapshot it
  • Configure VM networking and other necessities
  • Repeat if you have
    • 1 or more webserver
    • 1 or more application server
    • 1 or more database

Testing

  • Install all needed packages in the right version
  • Configure the stack and track every step to be able to debug / retry complex setups
  • snapshot, document and version control everything

Vagrant

  • DevTool only
  • Create, boot & install virtual servers and OS images
  • Convenient interface to running servers
  • Only one single text file
    • Syntax is Ruby
  • Works with virtualbox, VMWare, Docker, AWS and many more providers
  • Lots of plugins

Ansible

  • Production-ready
  • Deploy, configure and orchestrate software on multiple systems over SSH
  • Syntax is YAML
  • Can be one single text file

Vagrant + Ansible

  • Infrastructure as code
    • "Version control everything!"
  • Everybody on the team uses the same environment
    • No "but it works on my machine ..." excuse anymore
  • Seamless rollout to production
    • Just re-use the ansible playbook on production
    • Or: Create a VCS branch for production-playbooks

Vagrant + Ansible

  • Easier debugging
    • "It worked on yesterday's configuration, what changed since then?"
  • Faster desaster recovery
    • "Let's just start a fresh application cluster using yesterday's version of our software stack"
  • Implicit project documentation
    • Ansible playbooks can be read like a todo list

For hermits?

"You told us that this is about Vagrant + Ansible for hermits!"

 

"Is all this stuff actually useful when i am working on a solo project? Doesn't it slow me down?"

 

Let me show you an example...

Vagrant

We start a local virtualbox machine using the hardware and networking configuration which has been specified in a Vagrantfile and boot this box using an Ubuntu 14.04 image

Ansible

We install, deploy and configure our software stack:

  • psdash application as a git clone directly from github
  • Nginx as our webserver
  • Basic firewall config for HTTP and SSH access/limiting to the server

Vagrant & Ansible for hermits

By Stefan Antoni

Vagrant & Ansible for hermits

A short introduction how to develop in a clean environment with Vagrant and Ansible.

  • 779
Loading comments...

More from Stefan Antoni