A role should work on Ansible 2.15 to 2.18 and you must declare that.
AdvancedScenarioRoles, Collections and Project Structure
Answer
Situation read → Metadata for consumers and Galaxy.
What I'd do → Fill meta/main.yml, and for collections set requires_ansible in meta/runtime.yml.
galaxy_info:
role_name: nginx
min_ansible_version: "2.15"
platforms:
- { name: Ubuntu, versions: [jammy, noble] }
# collection meta/runtime.yml
requires_ansible: ">=2.15.0,<2.19"
Why → Consumers get a clear error instead of an obscure failure, and CI can test the matrix.
Interview tip → Test the declared matrix in CI, otherwise the range is wishful.
More on Roles, Collections and Project Structure
You have a 600-line playbook that sets up web, db and monitoring. How do you restructure it?BeginnerWhere do you put a variable users of your role are expected to override?BeginnerTwo roles need to run in a fixed order, such as `common` before `nginx`.BeginnerA role is used twice with different parameters in one play, but only runs once.IntermediateYou want to share roles across several repos and teams.IntermediateHow do you pin Ansible itself so a CI run today behaves like one last month?Intermediate