AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 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 "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, 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.

Crafting and Publishing Your Custom Ansible Collection on Automation Hub — Video Tutorial

Learn to create and publish a custom Ansible Collection "test.test" on Automation Hub. Follow steps to initialize, customize, build, and upload your collection.

Watch Video

Watch "Crafting and Publishing Your Custom Ansible Collection on Automation Hub" on YouTube

What You'll Learn

Full Tutorial Content

Introduction In the ever-evolving landscape of automation, creating customized solutions becomes paramount. Ansible Automation Hub provides a platform to showcase and share these custom creations with the world. In this guide, we’ll walk you through the process of crafting your custom Ansible Collection, named “test.test,” and publishing it on Ansible Automation Hub. Links - [Ansible Automation Hub](https://www.redhat.com/en/technologies/management/ansible/automation-hub) - https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html Step by step 1. Create the Custom Collection Begin your journey by creating the “test.test” collection using the ansible-galaxy command-line utility: ```bash ansible-galaxy collection init test.test ``` You’ll receive a confirmation that the “test.test” collection has been successfully created. ```bash - Collection test.test was created successfully ``` The command generates the following directory tree in the current directory: ```bash . └── test └── test ├── docs ├── galaxy.yml ├── meta │ └── runtime.yml ├── plugins │ └── README.md ├── README.md └── roles 6 directories, 4 files ``` 2. Customize the Collection Content Navigate into the collection directory and modify the “`runtime.yml`” file located at “`test/test/meta/runtime.yml`”. You can customize by adding additional modules, plugins, roles, etc. Here, set the “`requires_ansible`” parameter to specify the minimum Ansible version required: ```yaml --- Collections must specify a minimum required ansible version to upload to galaxy requires_ansible: '>=2.9.10' ``` 3. Build the Ansible Artifact The following command creates the “test-test-1.0.0.tar.gz” archive that we can publish in Automation Hub. Generate the “test-test-1.0.0.tar.gz” archive using the following command: ```bash ansible-galaxy collection build ``` Upon execution, the generated archive is ready to be published on Automation Hub. ```bash Created collection for test.test at /home/luca/collection/test/test/test-test-1.0.0.tar.gz ``` 4. Create a Namespace Access the Automation Hub interface and navigate to Collections > Namespace > Create. Enter “test” as the namespace name. Create the “test” namespace via the Collections > Namespace > Create menu and insert the “test” in the name pop-up window as shown in the following Figure: ![Automation Hub Create a Namespace](/articles/customcollection-createnamespace.jpg) 5. Create the Collection Within the newly created namespace, select the “Upload collection” button. Proceed by uploading the “test-test-1.0.0.tar.gz” file, created earlier with the `ansible-galaxy` command. Inside the namespace, select the “Upload collection” button to populate the “test.test” collection with the generated file. ![Automation Hub New Collection](/articles/customcollection-newcollection.jpg) Upload the “test-test-1.0.0.tar.gz” file generated by the ansible-galaxy comma

About This Tutorial

Read the full written article: Crafting and Publishing Your Custom Ansible Collection on Automation Hub

Topics Covered

Related Video Tutorials