In my previous post, I discussed learning linux. Now I want to talk about one of the cool things I’ve done with it. One thing that sucks about getting a new computer is going through all the program installations and configuration you need to do to really make it yours. Things like: installing your favorite browser, setting up your password manager, choosing a desktop background, etc. This is especially true for developers, who have to manage multiple tool chains of applications in order to do their work. Not to mention, we tend to be very picky about our text editors and IDEs. I’ve also been in the abnormal situation over the last year where I have setup my ubuntu desktop environment on five different computers. That’s a lot of setup.
And when I’m setting up my computer, there is almost always something I forget until I actually need it, and then I have to both set it up and use it.
There is a better way: automation. I can write scripts that will do that for me, so when I get a new computer I need to setup, I can login, type a few commands, and then be good to go. This is difficult to do in the Windows world, though project like boxstarter are making it better. On UNIX’s like Linux, though, this type of thing is richly supported. So last spring, I started working on automating my desktop setup using a technology called Ansible. All the code is available on github.
Ansible is a pretty cool technology. It is a way of declaratively describing your computer. For example, normally if you are installing a piece of software, you get the installer and tell the installer to install the software on the computer. With ansible, you simply declare that the software should be installed on the computer, and ansible makes it happen. It will test to see if it’s already installed, and if so, does nothing. If it’s not installed, ansible will install it.
It’s not perfect, because there are certain things that I haven’t automated yet. These are mainly around security issues, like setting up my ssh key, pgp key, connecting up my password manager, and things like that. I also haven’t focused on specifying how the computer should be setup outside of my little user (for the most part). For example, I don’t do anything with partitioning or video card configuration. I don’t think it would be useful to add those things due to all the boxes tending to have different hardware.
- Installs all the software I use.
- Copies my well known configuration for applications like my shell (oh-my-zsh), git, and various editors
- Sets my desktop theme and background
- Sets up LaTex
- Sets up my creative workflow for some vector editing when needed
- And most importantly: sets up cowsay
So when I need to setup my computer, I just need to type four commands to kick off the automation, and I’m pretty sure I can get it down to one command. Then I just wait for it to complete, usually 10-15 minutes later, and my computer is ready to be productive.
Any time I find a new piece of software that’s very useful, I just update my playbook to include that software, and then re-run the playbook. It installs the software, and I’m ready to go. But even better, I have three ubuntu desktops I use almost daily. I can use my automation to keep those things synchronized, so my tools are available across all of them. This makes me very happy.