Ansible Galaxy requirements.yml

requirements.yml is a file that lists the Collections and roles an Ansible project depends on, with their sources and versions. Running ansible-galaxy install -r requirements.yml installs everything listed, so every developer and CI/CD job uses the same dependencies.

requirements.yml example

collections:
  - name: amazon.aws
    version: "==8.0.0"
  - name: community.general
    version: ">=9.0.0,<10.0.0"
roles:
  - name: geerlingguy.nginx
    version: "3.2.0"

Pin versions. An unpinned Collection can introduce a breaking change into a Playbook that hasn’t been touched. The file is also the starting point for an Ansible SBOM.