How to fix ansible/vagrant ERROR! the role ‘swapfile’ was not found

This article provides a simple fix for the ansible error, “sorry, tersmitten.swapfile was not found”, by updating 1 (maybe 2?) .yml config file.

If you have encountered the above error, or “ERROR! the role ‘swapfile’ was not found”, then chances are you are using a dependency that is no longer supported (or more precisely, it looks like the github account owner has changed their username, from tersmitten to oefenweb). To fix the error simply update the reference to this resource in your config files. Here’s what I did:

In trellis/requirements.yml, change tersmitten to oefenweb and bump the version to v2.0.7:

- name: swapfile
  src: oefenweb.swapfile
  version: v2.0.7

If you are still encountering errors, remove swapfile_file: /swapfile, from the swapfile role, in server.yml. Change this:

  - { role: swapfile, swapfile_size: 1GB, swapfile_file: /swapfile, tags: [swapfile] }

To this:

  - { role: swapfile, swapfile_size: 1GB, tags: [swapfile] }

Then run $ vagrant provision again.

That’s it. Hopefully this will save you the hour that it took me resolve this error.