AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Ansible Galaxy Collections: Install, Use & requirements.yml Guide — Video Tutorial
How to download and use Ansible Galaxy collections. Install with ansible-galaxy, create requirements.yml, manage collection dependencies.
What You'll Learn
- How to Download and Use Ansible Galaxy Collection with ansible-galaxy and requirements.yml?
- What is an Ansible Collection?
- What is Ansible Galaxy?
- Links
- code
- execution without collection installed
- download execution
- list installed collection
- execution with collection installed
- Conclusion
Full Tutorial Content
How to Download and Use Ansible Galaxy Collection with ansible-galaxy and requirements.yml?
I’m going to show you a live Playbook with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
What is an Ansible Collection?
- distribution format for Ansible content
- it contains the package and distributes playbooks, roles, modules, and plugins using collections
- easy to download and share via Ansible Galaxy
An Ansible **Collection** is a distribution format for Ansible content. It solves one problem and contains all the relevant contains the package and distributes playbooks, roles, modules, and plugins. For Users, the Ansible Collection is easy to download and share via Ansible Galaxy. For Developers the Ansible Collection is easy to upload and share via Ansible Galaxy. Plus an Ansible Collection has a defined standard directory structure and format.
What is Ansible Galaxy?
- [Ansible Galaxy](https://galaxy.ansible.com/)
The website is available at the URL https://galaxy.ansible.com/.
The search engine, Tags, and Platform make it easy to find any content inside.
I recommend you carefully evaluate the quality of content before using it in your system.
Quality indicators are usually the quality assurance of code, the supported operating systems and platforms, the documentation, the release numbers, the presence of Changelog, the number of downloads, and the author or creator.
Please notice that the website contains Ansible Roles and Ansible Collections. Today we’re focusing on Ansible Role content.
Links
- [Ansible Collections list](https://github.com/ansible-collections)
- [Ansible Collections Developer Guide](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html)
- [Ansible Collections migrating roles](https://docs.ansible.com/ansible/latest/dev_guide/migrating_roles.html)
- [community.general collection](https://docs.ansible.com/ansible/latest/collections/community/general/)
## Playbook
Let’s jump into a real-life How to Download and Use the Ansible Galaxy Collection `community.general` in a system with `ansible-core` installed.
code
- collection.yml
```yaml
---
- name: modprobe module Playbook
hosts: localhost
become: true
vars:
module_name: "dummy"
ansible_connection: local
tasks:
- name: load the module
community.general.modprobe:
name: "{{ module_name }}"
state: present
```
- requirements.yml
```yaml
---
collections:
- name: community.general
source: https://galaxy.ansible.com
```
execution without collection installed
```bash
$ ansible-playbook collection/collection.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'
ERROR! couldn't resolve module/action 'community.general.modprobe'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/home/devops/collection/collection.yml': li
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 3 min
- Category: installation
Read the full written article: Ansible Galaxy Collections: Install, Use & requirements.yml Guide
Related Video Tutorials
- Download and Use Ansible Galaxy Role - ansible-galaxy and requirements.yml — Learn how to download and use the Ansible Galaxy Role lucab85.ansible_role_log4shell with ansible-core, including a step-by-step example.
- Ansible vs ansible-core: Package Differences Explained (2026) — Understand the difference between ansible and ansible-core packages. Compare contents, versions, installation, and choose the right package for your needs.
- Ansible Fix 'Role Not Found' Error: Path & Resolution Guide — Fix Ansible role not found error. Configure roles_path, install from Galaxy, check directory structure, and resolve common role loading issues.
- Crafting and Publishing Your Custom Ansible Collection on Automation Hub — Learn to create and publish a custom Ansible Collection "test.test" on Automation Hub. Follow steps to initialize, customize, build, and upload your collection.
- Creating a New Ansible Collection: A Step-by-Step Guide — Create a new Ansible Collection \"test.test\" with ansible-galaxy. Follow steps to initialize, build, and verify the collection, resulting in a distributable.
- How to install ansible-lint in macOS — How to install the ansible-lint command line utility and use it to improve our Ansible Playbooks in macOS Intel and Silicon.