About a year ago, I started to manage my laptop via Ansible (as much as I could, at least). I had some software installed via snapcraft, a new package manager from Canonical.

There was no Ansible module for snaps at the time, which was pretty surprising considering snapcraft has been getting quite some traction in the past few years. I assume it's mostly used on desktops, and Ansible is mostly used on servers, hence the missing module.

@vcarceler started to make a PR to add this module but did not answer to the reviews, so the PR has been dead for a few months. Thanks to him though, otherwise what follows probably wouldn't have happened.

Since I was really into Ansible a the time, I decided to dig into modules and make snap + Ansible possible.

I was actually surprised by how simple it is. Ansible is not magic, and everything makes sense once you start digging into the modules.

Once I had something functional, I submitted a PR and I was anxiously waiting for any comment, review or any form of feedback... Submitting your work for reviews to a 30k stars project is stressful. 😌

I was incredibly lucky that my PR was picked up and reviewed by @webknjaz. The PR has 69 commits and 169 comments (!) and Sviatoslav kindly reviewed each of my commit for nearly two months, despite my obvious inexperience in Python and Ansible modules. After many nights of work, he finally approved the PR.

I really want to thank him because I learned a lot while working on this, and it really motivated me to contribute to open-source projects as much as I can.

Anyway, the module is not perfect and it can always be improved, but it works pretty well. Even though it made it into the master branch in October of 2018, I missed the 2.7 freeze so it's only released now with version 2.8, 7 months later.

If you're interested, here is the code, and here is the documentation.

The modules supports:

  • Installing snaps
  • Removing snaps
  • Choosing a channel
  • Enabling the classic confinement policy.

Enjoy! And thanks again to the Ansible community. 🤗