Interview Prep/Ansible/Roles, Collections and Galaxy

How do you install collections reproducibly?

IntermediateConceptRoles, Collections and Galaxy
Answer
# requirements.yml
collections:
  - name: amazon.aws
    version: ">=9.0.0,<10.0.0"
  - name: community.general
    version: 10.1.0
  - name: https://github.com/example-org/platform.git
    type: git
    version: main
ansible-galaxy collection install -r requirements.yml -p ./collections
ansible-galaxy collection list

-p ./collections keeps dependencies in the project. Use exact pins in CI and a lock-style process (or an execution environment) for production.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy