After all the reading about Ansible that I’ve done yesterday, I woke up today with a strong will to try it out. Running a few “hello world” examples wasn’t illustrative enough, so I decided to migrate my dotfiles repository from Puppet to Ansible. This would provide just enough complexity to try things out, without any danger of breaking things horribly.
I’m proud to say that it took me only about two-three hours of trying things out to complete this task. In the process, the following things were tried:
- Ansible best practices
- Playbooks (site.yml)
- Roles (dotfiles, fonts, vim, git)
- Tasks (file system operations, package installation, git repositories)
- Tags (I’m using files, packages, network)
- Loops (file globs, ad hoc items, pre-defined lists)
- Filters (basename is super handy)
- Inventories (mostly for variables, but played around with hosts too)
- Variables (lists definitions for tasks, variables for templates)
- Templates (.gitconfig with the user name, email, and GitHub username).
One of the things that I haven’t tried yet is using non-core modules (Ansible Galaxy, etc). I will, eventually. But for now I have to say that Ansible provides enough functionality out of the box to run the most common tasks.
When I was done, the resulting change set had (according to diffstat):
- 213 files changed,
- 2,177 lines inserted,
- 11,975 lines deleted.
The majority of these changes were, of course, the removal of Puppet modules from the repository, not the actual configurations.
My initial impressions are:
- Ansible is indeed much easier and simpler to get started with. Maybe because I’ve already been through the configuration management initiation with Puppet.
- Like any other system, it has its quirks, which will need time to get used to. For example, recursively coping a directory locally is not as easy as you might think.
- YAML is not as bad as it looks, once you’ve been editing it for a couple of hours non-stop.
Overall, I’m pretty happy with how it goes. Next up – trying it out for provisioning some of my servers. And then, if all goes well, using it for project deployment as well.