requirements.yml
A YAML file listing the collections and roles a project depends on, with versions, for ansible-galaxy to install.
In more detail
Keep it beside the playbooks and install from it in a controlled setup step: ansible-galaxy install -r requirements.yml. Review changes to it like code, because a new version of a dependency can change what runs on every host.
Example
collections:
- name: ansible.posix
version: 2.0.0Related terms
- Ansible Galaxy — The public online hub for sharing Ansible roles and collections, and the ansible-galaxy command that installs from it.
- Ansible collection — A distribution package of Ansible content, such as modules, plugins, roles and documentation, published under a namespace.
- pinning — Fixing an exact version or digest of something you depend on so it cannot change without you noticing.
- dependency — Anything a program needs in order to work, such as a library, a tool or another service.
- requirements.txt — A text file listing the Python packages, and usually their exact versions, that pip should install for a project.
Taught in
- Using Collections — Ansible Configuration Management at Scale
- Ansible Galaxy — Ansible Configuration Management at Scale
- Roles: The Directory Ansible Expects, Defaults And Handlers — RHCE in Ansible (EX294): Automate Red Hat Systems
- requirements.yml: Installing Roles And Collections — RHCE in Ansible (EX294): Automate Red Hat Systems
References
- Installing collections: using a requirements file
- Galaxy user guide: installing multiple roles from a file