Table of Contents

About

Collections are a distribution format that package:

  • playbooks,
  • roles,
  • modules,
  • and
  • plugins.

You can publish and use collections through Ansible Galaxy.

Example

https://github.com/bcoca/collection

Management

Create

ansible-galaxy collection init  my_namespace.my_collection

Example: https://github.com/bcoca/collection

Build

Build the collection into a collection artifact

ansible-galaxy collection build

creates a tarball of the built collection in the current directory which can be uploaded to Galaxy.:

my_collection/
├── galaxy.yml
├── ...
├── my_namespace-my_collection-1.0.0.tar.gz
└── ...

Publish

Publish the collection artifact to Galaxy

ansible-galaxy collection publish
# or
ansible-galaxy collection publish path/to/my_namespace-my_collection-1.0.0.tar.gz --api-key=SECRET

Install

From the tarball created during the build

ansible-galaxy collection install my_namespace-my_collection-1.0.0.tar.gz -p ./collections

Documentation