Project organization

Curious how others are organizing their Ansible projects. There are a lot of possible schemes and all seem basically equivalent, but I’ve not been able to settle on one that really works. My “units” for configuration include things like “nginx”, “mysql”, “deploy_user”, etc. Here are the schemes I’ve considered:

  1. Make each unit its own playbook. This has the advantage that each playbook is individually runnable. The downside is that it’s a little more challenging to organize variables, files, etc. which makes roles more attractive.
  2. Organize each unit in to roles. Obviously solves some of the organization issues. The downside is that there are several roles that don’t have very many tasks or no variables/files, so having an entire role folder for just a couple tasks seems a little heavy
  3. Use fewer roles like “core”, “development”, etc. in which each unit is in its own tasks file

The scheme that I’ll probably settle on is #2, then create playbooks for each type of server–development, staging, production, etc. that include the necessary roles. Any other considerations? How are others keeping things organized?

We use #2, and control what/where through inventory and variables, rather than separate playbooks for separate environments.