3 ms·
Okay, can someone please explain Packer/Vagrant/etc to me? The way I currently provision is using ansible, I have a script that goes from bare machine to servin
by StavrosK 13y ago
Okay, can someone please explain Packer/Vagrant/etc to me? The way I currently provision is using ansible, I have a script that goes from bare machine to serving the site in one command (http://www.stavros.io/posts/example-provisioning-and-deployment-ansible/ http://www.stavros.io/posts/example-provisioning-and-deploym...).
How does something like Packer/Vagrant help me? From what I understand, all they do is create a VM, which just takes two seconds in VirtualBox anyway. There must be a benefit, since everyone is using them, but I'm missing it. Can anyone please explain?
- njharman 13y ago> How does something like Packer/Vagrant help me? Totally depends on what you need doing. Might want to check out use cases in the packer documentation. There is some overlap in all these tools. ThAnsible/Salt/Chef/Puppet tend to used to manage "live" OS's/systems, keeping them updated, deploying new builds to them. Although some like Ansible are more generic. Vagrant and Packer(I know little) manage images. Starting, stoping, provisioning (and often running one of the above Configuration Managments to finish customizing. Although some believe in running from pure AMI, updating them instead of the live systems). They get more power when there are many devs, lots of images. I.E. when you have enough complexity you need help managing it. If your small or simple (no negative connotation implied) they probably aren't worth it. I'm one man shop and use Ansible cause it's the right fit for that (although it's expanding fast).
- StavrosK 13y agoHmm, so what they do is generate an image, "freeze" and deploy it? I'm not very big on that philosophy, I prefer having a script to take the system from a clean state to the current state at all times, but I guess that's just preference. Maybe it's just that I don't have a big enough need for it, but I did see people using it for single VMs/servers, so I was wondering. Thanks for the explanation! Also, have you seen ansible's pull mode? I just saw it the other day and I am itching to try it, it looks phenomenal.
- dekz 13y agoWell Vagrant existed as a way to take some known state and run it headless. It was good to say, "Here is the image we run on, now develop on it", where that image may not be your actual desktop machine. It helps avoid the "issue" of the problem being yours (desktop, rbenv, wrong openssl etc) and not mine (or code). This worked by running Virtual box in a headless mode and doing some nifty things to the VM (through SSH) for you. Then it took on the optional use case of also running some Provisioning ontop of the VM. We could start from a base ubuntu, get to a point where our app could run and then deploy the app ontop. It was a little cumbersome but it worked. Then Mitchel started adding other platforms for it to run under (VMWare Workstation) instead of just VirtualBox. I believe he is still working on these and is adding more like VMWare VSphere. So Vagrant was always more to do with running of the VMS or taking the VMs and putting them somewhere and turning them on. Packer is more of the former tool of creating the VM in the first place I guess. I feel from the little I do know that Packer and Vagrant seem to be sharing some of the same goals and solutions. I guess mitchel and comment further on where he plans to draw the line between the two.
- StavrosK 13y agoI see, thanks. I guess creating VMs has never been a big problem for me, but, then again, it sounds like Vagrant isn't targeted towards me.
- johnbender 13y agoI'm not familiar with ansible so I won't attempt to compare the two but I can offer you a short list of benefits that Vagrant provides over building VMs manually with Virtualbox, VMWare, etc. 1. Single command setup across virtualization platforms 2. Tight integration with provisioning tools (ships local config to VM and runs) 3. Network configuration* 4. Automated shared folders (includes NFS since VBox has really bad shared folders) 5. Generally homogeneous config across host and virtualization platforms 6. Safe cleanup on command cancellation (ie, very safe/sane command line behavior) There's much more to add but this is nice short list. [UPDATE] Generally speaking it takes the idea of using VMs locally to guarantee a development environment/state and streamlines the process enormously. * Most people underestimate the number of ways that you can screw up network config on local VMs.
- zimbatm 13y agoThe combo of point 2 and 4 is what makes the real difference IMO. Since it's easy to provision a new box with a single command and you don't maintain state on them, you get disposable VMs. No more going trough a list of VMs and asking yourself if you left any work on that or if you can scrap it. Just `vagrant destroy` and `vagrant up` when you need it again. Plus the provisioning bits gets tested a lot more.
- 1_player 13y agoOff topic: please make your site responsive. I really wanted to read your blog from my phone but the current layout makes it impossible. Anyway, thanks for that article, very informative.
- StavrosK 13y agoI know, it's bad on mobiles, I'll have to change the whole theme :/ I have started to grow tired of the old one, I want to get a cleaner one. I'll try to make some time for that, thanks for reading, I'm glad you enjoyed it!