Skip to content

Collections

What You'll Learn

  • What a collection actually is, and how it relates to ansible-core
  • How to install one and use it correctly with FQCNs
  • Where to find collections, and how to pin their versions

Why Collections Exist

ansible-core ships the engine and a small ansible.builtin module set — everything else (cloud providers, network vendors, community tooling) is distributed as a collection: a versioned, installable bundle of modules, plugins, and roles under one namespace.

amazon.aws.ec2_instance      # namespace.collection.module
community.general.timezone
ansible.posix.mount

This is precisely why FQCNs matter in practice (see Modules) — namespace.collection.module tells you exactly which package a module came from, with no ambiguity about which collection's version of a same-named module is running.

Minimal Example

requirements.yml
collections:
  - name: community.general
    version: ">=8.0.0"
  - name: amazon.aws
    version: "8.1.0"
ansible-galaxy collection install -r requirements.yml

Pin collection versions the same way you'd pin any other dependency — an unpinned ansible-galaxy collection install community.general today and next month can silently resolve to different module behavior.

Read in this order

  1. Collection Structure — what's actually inside one
  2. Installing and Using Collectionsrequirements.yml, version pinning, offline installs
  3. Publishing Collections — sharing your own

To build one from scratch, see Build a Collection From Zero in the next section.

Next

Continue to Build Your Own.