Roles: How to structure a role(s) for a AWS configuration

Hey,

Sorry for the rubbish title. hard to summarise my question(s).

I’m looking to restructure an AWS estate, and I’m going to be using Ansible to drive CloudFormation and other parts of AWS.

The stacks will be more or less the same in each environment with the odd difference, and in my head I have two ways of how I approach this.

Option 1

I have a single role for a cloud formation stack. Within this role are all the templates, and a tasks/main.yml that creates a single stack.

I can then define playbooks for each environment that call the role multiple times with parameters defining what stack it should contain and the variables for those stacks, i.e. instance size, etc (I’m going to put the environment specific variables in the playbook).

If I do go down this route, there will be the odd task that won’t be a CloudFormation stack. Shall I put that as another task file within the role, or as a separate roll altogether? Can you actually do the former? Not sure how to include a role and not execute the main.yml but another one.

Option 2

I go down the verbose route. I have a single role per CloudFormation stack and adhoc task, and just include each one as and when I want them in an environment.

Personally that feels like overkill and would have a lot of repetition (looking at 10+ stacks CloudFormation stacks for all the various elements).