Installing Collections with a Requirements File
Categories:
An
Ansible playbook project
such as
c2platform/rws/ansible-gis
typically contains a requirements file collections\requirements.yml. The example content for this file is shown below:
---
collections:
  - name: ansible.windows
    version: 1.14.0
  - name: community.windows
    version: 1.13.0
  - name: https://gitlab.com/c2platform/rws/ansible-collection-gis.git
    type: git
    version: 1.0.1
  - name: https://gitlab.com/c2platform/rws/ansible-collection-wincore.git
    type: git
    version: master
Based on the given Ansible requirements file, Ansible will perform the following actions:
- Install the collection ansible.windowswith version1.14.0.
- Install the collection community.windowswith version1.13.0.
- Clone the Git repository https://gitlab.com/c2platform/rws/ansible-collection-gis.gitand install the collection with version1.0.1.
- Clone the Git repository https://gitlab.com/c2platform/rws/ansible-collection-wincore.gitand install the collection from themasterbranch.
Ansible will execute these actions when the command ansible-galaxy collection install -r collections/requirements.yml -p . is run. The -r flag specifies the requirements file to be used, and the -p flag specifies the path where the collections will be installed (in this case, the current directory).
ansible-galaxy collection install -r collections/requirements.yml -p .
Moreover, this file can also be used by Ansible Automation Platform ( AAP ) or AWX . For more information see Installing collections — Ansible Documentation
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.