[Discuss] "Stack Script" (shell script) to build Ubuntu LAMP + on Linode
Edward Ned Harvey (blu)
blu at nedharvey.com
Wed Apr 8 07:01:32 EDT 2015
> From: greg.rundlett at gmail.com [mailto:greg.rundlett at gmail.com] On Behalf
> Of Greg Rundlett (freephile)
>
> So, now that I'm looking at Vagrant, Juju [1], Ansible [2], Puppet [3] and
> others as well as revisiting the general virtualization landscape (e.g. LXC,
> Docker, CoreOS).
>
> Does anyone have their favorite deployment tips, playbooks or stories to
> share?
One of my coworkers is absolutely in love with vagrant, but I don't like it because it only plays easily nice with a local virtualbox. For him, he's doing experimental or development drupal work, that works great. For me, I'm operating infrastructure to support people, I need to interact with a much broader set of vmware, aws, digital ocean - which vagrant technically *can* do, but the added complexity negates the benefit. It's just a wrapper around ansible/whatever anyway. So I just use ansible and forget vagrant.
The thing I like about ansible, besides the obvious - Ok, here's the obvious - In the past, machines were sometimes not well documented, and even if they were well documented, following the documentation was manual and error prone (hence you writing your script). By writing executable documentation, you get repeatability and it becomes trivial to spin up a development machine that exactly clones the production system, then make a change on development and test, and apply the change to production.
Ok, so besides the obvious, I like the fact that I don't need a dedicated control machine. I can do stuff locally on my mac, which ssh's out to the target machines to do my work for me. I find, however, that if you have any windows administrators on your team, it becomes worthwhile to build a dedicated control machine - some linux box that everyone ssh's into in order to run ansible commands. Because even with cygwin, there is no ansible on windows. (Last I knew, as far as I know.)
All that script stuff you wrote is how I used to do things. The language in ansible makes a lot of that stuff trivial. For example, how do you script "Go into the my.conf file, find the [FooBar] section, and if the 'whizbang' feature is in there, edit it to 5, otherwise create a line 'whizbang=5'" ... Yes it can be done, but it's a pain. But this type of configuration setting is just a line in ansible. Because that's what it's designed for. And what if assumptions were made in your script that are no longer correct when you run the script? The shell script is likely to fail horribly doing terrible things. Ansible will just report the error on the specific machine, and stop running on that machine.
More information about the Discuss
mailing list