Interview Prep/Ansible/Roles, Collections and Project Structure

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.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Project Structure