Installing and Using Collections¶
Section status: outline
This page is scoped but not yet written in full prose. The sections below define what it will cover.
What It Will Cover¶
requirements.ymlas the collection equivalent ofrequirements.txt— always commit it, always pin versionsansible-galaxy collection install -r requirements.yml, and-p ./collectionsto install project-local instead of user-wideANSIBLE_COLLECTIONS_PATHand collection search order (project-local vs. user vs. system)- Building an offline/air-gapped install with
ansible-galaxy collection download - Verifying what's installed:
ansible-galaxy collection list
Common Mistakes¶
- Installing collections user-wide with no
requirements.yml, so a teammate's environment silently has different versions. - Not pinning versions, letting a collection update change module behavior underneath an otherwise-unchanged playbook.
Interview Questions¶
- Why should collection versions be pinned in
requirements.ymlrather than installed ad hoc? - How would you prepare an air-gapped install of the collections a project needs?
Next¶
Continue to Publishing Collections.